View Source Evision (Evision v0.1.7-dev)

Link to this section Summary

cv

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the per-element absolute difference between two arrays or between an array and a scalar. The function cv::absdiff calculates

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the per-element absolute difference between two arrays or between an array and a scalar. The function cv::absdiff calculates

Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • mask: UMat.

Adds an image to the accumulator image. The function adds src or some of its elements to dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently. The function cv::accumulate can be used, for example, to collect statistics of a scene background viewed by a still camera and for the further foreground-background segmentation. @sa accumulateSquare, accumulateProduct, accumulateWeighted

Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • mask: UMat.

Adds an image to the accumulator image. The function adds src or some of its elements to dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently. The function cv::accumulate can be used, for example, to collect statistics of a scene background viewed by a still camera and for the further foreground-background segmentation. @sa accumulateSquare, accumulateProduct, accumulateWeighted

Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • dst: UMat.
Keyword Arguments
  • mask: UMat.

Adds the per-element product of two input images to the accumulator image. The function adds the product of two images or their selected regions to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src1} (x,y) \cdot \texttt{src2} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.

Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • dst: UMat.
Keyword Arguments
  • mask: UMat.

Adds the per-element product of two input images to the accumulator image. The function adds the product of two images or their selected regions to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src1} (x,y) \cdot \texttt{src2} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.

Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • mask: UMat.

Adds the square of a source image to the accumulator image. The function adds the input image src or its selected region, raised to a power of 2, to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y)^2 \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.

Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • mask: UMat.

Adds the square of a source image to the accumulator image. The function adds the input image src or its selected region, raised to a power of 2, to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y)^2 \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.

Positional Arguments
  • src: UMat.
  • dst: UMat.
  • alpha: double.
Keyword Arguments
  • mask: UMat.

Updates a running average. The function calculates the weighted sum of the input image src and the accumulator dst so that dst becomes a running average of a frame sequence: \f[\texttt{dst} (x,y) \leftarrow (1- \texttt{alpha} ) \cdot \texttt{dst} (x,y) + \texttt{alpha} \cdot \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images). The function supports multi-channel images. Each channel is processed independently.

Positional Arguments
  • src: UMat.
  • dst: UMat.
  • alpha: double.
Keyword Arguments
  • mask: UMat.

Updates a running average. The function calculates the weighted sum of the input image src and the accumulator dst so that dst becomes a running average of a frame sequence: \f[\texttt{dst} (x,y) \leftarrow (1- \texttt{alpha} ) \cdot \texttt{dst} (x,y) + \texttt{alpha} \cdot \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images). The function supports multi-channel images. Each channel is processed independently.

Positional Arguments
  • src: UMat.
  • maxValue: double.
  • adaptiveMethod: int.
  • thresholdType: int.
  • blockSize: int.
  • c: double.
Keyword Arguments
  • dst: UMat.

Applies an adaptive threshold to an array. The function transforms a grayscale image to a binary image according to the formulae

Positional Arguments
  • src: UMat.
  • maxValue: double.
  • adaptiveMethod: int.
  • thresholdType: int.
  • blockSize: int.
  • c: double.
Keyword Arguments
  • dst: UMat.

Applies an adaptive threshold to an array. The function transforms a grayscale image to a binary image according to the formulae

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • mask: UMat.
  • dtype: int.

Calculates the per-element sum of two arrays or an array and a scalar. The function add calculates

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • mask: UMat.
  • dtype: int.

Calculates the per-element sum of two arrays or an array and a scalar. The function add calculates

Positional Arguments
  • img: Mat.
  • text: String.
  • org: Point.
  • nameFont: String.
Keyword Arguments
  • pointSize: int.
  • color: Scalar.
  • weight: int.
  • style: int.
  • spacing: int.

Draws a text on the image.

Positional Arguments
  • img: Mat.
  • text: String.
  • org: Point.
  • nameFont: String.
Keyword Arguments
  • pointSize: int.
  • color: Scalar.
  • weight: int.
  • style: int.
  • spacing: int.

Draws a text on the image.

Positional Arguments
  • src1: UMat.
  • alpha: double.
  • src2: UMat.
  • beta: double.
  • gamma: double.
Keyword Arguments
  • dst: UMat.
  • dtype: int.

Calculates the weighted sum of two arrays. The function addWeighted calculates the weighted sum of two arrays as follows: \f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} + \texttt{src2} (I)* \texttt{beta} + \texttt{gamma} )\f] where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. The function can be replaced with a matrix expression

Positional Arguments
  • src1: UMat.
  • alpha: double.
  • src2: UMat.
  • beta: double.
  • gamma: double.
Keyword Arguments
  • dst: UMat.
  • dtype: int.

Calculates the weighted sum of two arrays. The function addWeighted calculates the weighted sum of two arrays as follows: \f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} + \texttt{src2} (I)* \texttt{beta} + \texttt{gamma} )\f] where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. The function can be replaced with a matrix expression

Variaint 1:

Positional Arguments
  • src: UMat.
  • userColor: UMat.
Keyword Arguments
  • dst: UMat.

Applies a user colormap on a given image.

Variaint 1:

Positional Arguments
  • src: UMat.
  • userColor: UMat.
Keyword Arguments
  • dst: UMat.

Applies a user colormap on a given image.

Positional Arguments
  • curve: UMat.
  • epsilon: double.
  • closed: bool.
Keyword Arguments
  • approxCurve: UMat.

Approximates a polygonal curve(s) with the specified precision. The function cv::approxPolyDP approximates a curve or a polygon with another curve/polygon with less vertices so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm

Positional Arguments
  • curve: UMat.
  • epsilon: double.
  • closed: bool.
Keyword Arguments
  • approxCurve: UMat.

Approximates a polygonal curve(s) with the specified precision. The function cv::approxPolyDP approximates a curve or a polygon with another curve/polygon with less vertices so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm

Calculates a contour perimeter or a curve length. The function computes a curve length or a closed contour perimeter.

Positional Arguments
  • img: UMat. Image.
  • pt1: Point.
  • pt2: Point.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • line_type: int.
  • shift: int.
  • tipLength: double.

Draws an arrow segment pointing from the first point to the second one. The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line.

Positional Arguments
  • img: UMat. Image.
  • pt1: Point.
  • pt2: Point.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • line_type: int.
  • shift: int.
  • tipLength: double.

Draws an arrow segment pointing from the first point to the second one. The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line.

Positional Arguments
  • src1: UMat
  • src2: UMat
  • dtype: int
Keyword Arguments
  • dist: UMat.
  • nidx: UMat.
  • normType: int.
  • k: int.
  • mask: UMat.
  • update: int.
  • crosscheck: bool.

naive nearest neighbor finder see http://en.wikipedia.org/wiki/Nearest_neighbor_search @todo document

Positional Arguments
  • src1: UMat
  • src2: UMat
  • dtype: int
Keyword Arguments
  • dist: UMat.
  • nidx: UMat.
  • normType: int.
  • k: int.
  • mask: UMat.
  • update: int.
  • crosscheck: bool.

naive nearest neighbor finder see http://en.wikipedia.org/wiki/Nearest_neighbor_search @todo document

Positional Arguments
  • src: UMat.
  • d: int.
  • sigmaColor: double.
  • sigmaSpace: double.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Applies the bilateral filter to an image. The function applies bilateral filtering to the input image, as described in http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is very slow compared to most filters. Sigma values: For simplicity, you can set the 2 sigma values to be the same. If they are small (\< 10), the filter will not have much effect, whereas if they are large (> 150), they will have a very strong effect, making the image look "cartoonish". Filter size: Large filters (d > 5) are very slow, so it is recommended to use d=5 for real-time applications, and perhaps d=9 for offline applications that need heavy noise filtering. This filter does not work inplace.

Positional Arguments
  • src: UMat.
  • d: int.
  • sigmaColor: double.
  • sigmaSpace: double.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Applies the bilateral filter to an image. The function applies bilateral filtering to the input image, as described in http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is very slow compared to most filters. Sigma values: For simplicity, you can set the 2 sigma values to be the same. If they are small (\< 10), the filter will not have much effect, whereas if they are large (> 150), they will have a very strong effect, making the image look "cartoonish". Filter size: Large filters (d > 5) are very slow, so it is recommended to use d=5 for real-time applications, and perhaps d=9 for offline applications that need heavy noise filtering. This filter does not work inplace.

Positional Arguments
  • src1: UMat
  • src2: UMat
  • weights1: UMat
  • weights2: UMat
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Positional Arguments
  • src1: UMat
  • src2: UMat
  • weights1: UMat
  • weights2: UMat
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Positional Arguments
  • src: UMat.
  • ksize: Size.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • borderType: int.

Blurs an image using the normalized box filter. The function smooths an image using the kernel: \f[\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \end{bmatrix}\f] The call blur(src, dst, ksize, anchor, borderType) is equivalent to boxFilter(src, dst, src.type(), ksize, anchor, true, borderType).

Positional Arguments
  • src: UMat.
  • ksize: Size.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • borderType: int.

Blurs an image using the normalized box filter. The function smooths an image using the kernel: \f[\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \end{bmatrix}\f] The call blur(src, dst, ksize, anchor, borderType) is equivalent to boxFilter(src, dst, src.type(), ksize, anchor, true, borderType).

Computes the source location of an extrapolated pixel. The function computes and returns the coordinate of a donor pixel corresponding to the specified extrapolated pixel when using the specified extrapolation border mode. For example, if you use cv::BORDER_WRAP mode in the horizontal direction, cv::BORDER_REFLECT_101 in the vertical direction and want to compute value of the "virtual" pixel Point(-5, 100) in a floating-point image img , it looks like

Calculates the up-right bounding rectangle of a point set or non-zero pixels of gray-scale image. The function calculates and returns the minimal up-right bounding rectangle for the specified point set or non-zero pixels of gray-scale image.

Positional Arguments
  • src: UMat.
  • ddepth: int.
  • ksize: Size.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • normalize: bool.
  • borderType: int.

Blurs an image using the box filter. The function smooths an image using the kernel: \f[\texttt{K} = \alpha \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \end{bmatrix}\f] where \f[\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} & \texttt{when } \texttt{normalize=true} \\1 & \texttt{otherwise}\end{cases}\f] Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on). If you need to compute pixel sums over variable-size windows, use #integral.

Positional Arguments
  • src: UMat.
  • ddepth: int.
  • ksize: Size.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • normalize: bool.
  • borderType: int.

Blurs an image using the box filter. The function smooths an image using the kernel: \f[\texttt{K} = \alpha \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \end{bmatrix}\f] where \f[\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} & \texttt{when } \texttt{normalize=true} \\1 & \texttt{otherwise}\end{cases}\f] Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on). If you need to compute pixel sums over variable-size windows, use #integral.

Positional Arguments
  • box: RotatedRect.
Keyword Arguments
  • points: UMat.

Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle. The function finds the four vertices of a rotated rectangle. This function is useful to draw the rectangle. In C++, instead of using this function, you can directly use RotatedRect::points method. Please visit the @ref tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information.

Positional Arguments
  • box: RotatedRect.
Keyword Arguments
  • points: UMat.

Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle. The function finds the four vertices of a rotated rectangle. This function is useful to draw the rectangle. In C++, instead of using this function, you can directly use RotatedRect::points method. Please visit the @ref tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information.

Positional Arguments
  • img: UMat.
  • winSize: Size.
  • maxLevel: int.
Keyword Arguments
  • pyramid: vector_UMat.
  • withDerivatives: bool.
  • pyrBorder: int.
  • derivBorder: int.
  • tryReuseInputImage: bool.

Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.

Positional Arguments
  • img: UMat.
  • winSize: Size.
  • maxLevel: int.
Keyword Arguments
  • pyramid: vector_UMat.
  • withDerivatives: bool.
  • pyrBorder: int.
  • derivBorder: int.
  • tryReuseInputImage: bool.

Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.

Positional Arguments
  • images: vector_UMat
  • channels: vector_int
  • hist: UMat
  • ranges: vector_float
  • scale: double
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Positional Arguments
  • images: vector_UMat
  • channels: vector_int
  • hist: UMat
  • ranges: vector_float
  • scale: double
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Positional Arguments
  • samples: UMat.
  • mean: UMat.
  • flags: int.
Keyword Arguments
  • covar: UMat.
  • ctype: int.

Has overloading in C++

Positional Arguments
  • samples: UMat.
  • mean: UMat.
  • flags: int.
Keyword Arguments
  • covar: UMat.
  • ctype: int.

Has overloading in C++

Positional Arguments
  • images: vector_UMat
  • channels: vector_int
  • mask: UMat
  • histSize: vector_int
  • ranges: vector_float
Keyword Arguments
  • hist: UMat.
  • accumulate: bool.

Has overloading in C++

Positional Arguments
  • images: vector_UMat
  • channels: vector_int
  • mask: UMat
  • histSize: vector_int
  • ranges: vector_float
Keyword Arguments
  • hist: UMat.
  • accumulate: bool.

Has overloading in C++

Positional Arguments
  • prevImg: UMat.
  • nextImg: UMat.
  • prevPts: UMat.
  • nextPts: UMat.
Keyword Arguments
  • status: UMat.
  • err: UMat.
  • winSize: Size.
  • maxLevel: int.
  • criteria: TermCriteria.
  • flags: int.
  • minEigThreshold: double.

Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.

Positional Arguments
  • prevImg: UMat.
  • nextImg: UMat.
  • prevPts: UMat.
  • nextPts: UMat.
Keyword Arguments
  • status: UMat.
  • err: UMat.
  • winSize: Size.
  • maxLevel: int.
  • criteria: TermCriteria.
  • flags: int.
  • minEigThreshold: double.

Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.

Positional Arguments
  • objectPoints: vector_UMat
  • imagePoints: vector_UMat
  • imageSize: Size
  • cameraMatrix: UMat
  • distCoeffs: UMat
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • flags: int.
  • criteria: TermCriteria.

Has overloading in C++

Positional Arguments
  • objectPoints: vector_UMat
  • imagePoints: vector_UMat
  • imageSize: Size
  • cameraMatrix: UMat
  • distCoeffs: UMat
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • flags: int.
  • criteria: TermCriteria.

Has overloading in C++

Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints: vector_UMat.
  • imageSize: Size.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • stdDeviationsIntrinsics: UMat.
  • stdDeviationsExtrinsics: UMat.
  • perViewErrors: UMat.
  • flags: int.
  • criteria: TermCriteria.

Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.

Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints: vector_UMat.
  • imageSize: Size.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • stdDeviationsIntrinsics: UMat.
  • stdDeviationsExtrinsics: UMat.
  • perViewErrors: UMat.
  • flags: int.
  • criteria: TermCriteria.

Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.

Positional Arguments
  • objectPoints: vector_UMat
  • imagePoints: vector_UMat
  • imageSize: Size
  • iFixedPoint: int
  • cameraMatrix: UMat
  • distCoeffs: UMat
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • newObjPoints: UMat.
  • flags: int.
  • criteria: TermCriteria.

Has overloading in C++

Positional Arguments
  • objectPoints: vector_UMat
  • imagePoints: vector_UMat
  • imageSize: Size
  • iFixedPoint: int
  • cameraMatrix: UMat
  • distCoeffs: UMat
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • newObjPoints: UMat.
  • flags: int.
  • criteria: TermCriteria.

Has overloading in C++

Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints: vector_UMat.
  • imageSize: Size.
  • iFixedPoint: int.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • newObjPoints: UMat.
  • stdDeviationsIntrinsics: UMat.
  • stdDeviationsExtrinsics: UMat.
  • stdDeviationsObjPoints: UMat.
  • perViewErrors: UMat.
  • flags: int.
  • criteria: TermCriteria.

Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern. This function is an extension of #calibrateCamera with the method of releasing object which was proposed in @cite strobl2011iccv. In many common cases with inaccurate, unmeasured, roughly planar targets (calibration plates), this method can dramatically improve the precision of the estimated camera parameters. Both the object-releasing method and standard method are supported by this function. Use the parameter iFixedPoint for method selection. In the internal implementation, #calibrateCamera is a wrapper for this function.

Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints: vector_UMat.
  • imageSize: Size.
  • iFixedPoint: int.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • newObjPoints: UMat.
  • stdDeviationsIntrinsics: UMat.
  • stdDeviationsExtrinsics: UMat.
  • stdDeviationsObjPoints: UMat.
  • perViewErrors: UMat.
  • flags: int.
  • criteria: TermCriteria.

Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern. This function is an extension of #calibrateCamera with the method of releasing object which was proposed in @cite strobl2011iccv. In many common cases with inaccurate, unmeasured, roughly planar targets (calibration plates), this method can dramatically improve the precision of the estimated camera parameters. Both the object-releasing method and standard method are supported by this function. Use the parameter iFixedPoint for method selection. In the internal implementation, #calibrateCamera is a wrapper for this function.

Positional Arguments
  • r_gripper2base: vector_UMat.
  • t_gripper2base: vector_UMat.
  • r_target2cam: vector_UMat.
  • t_target2cam: vector_UMat.
Keyword Arguments
  • r_cam2gripper: UMat.
  • t_cam2gripper: UMat.
  • method: HandEyeCalibrationMethod.

Computes Hand-Eye calibration: \f$_{}^{g}\textrm{T}_c\f$

Positional Arguments
  • r_gripper2base: vector_UMat.
  • t_gripper2base: vector_UMat.
  • r_target2cam: vector_UMat.
  • t_target2cam: vector_UMat.
Keyword Arguments
  • r_cam2gripper: UMat.
  • t_cam2gripper: UMat.
  • method: HandEyeCalibrationMethod.

Computes Hand-Eye calibration: \f$_{}^{g}\textrm{T}_c\f$

Positional Arguments
  • r_world2cam: vector_UMat.
  • t_world2cam: vector_UMat.
  • r_base2gripper: vector_UMat.
  • t_base2gripper: vector_UMat.
Keyword Arguments
  • r_base2world: UMat.
  • t_base2world: UMat.
  • r_gripper2cam: UMat.
  • t_gripper2cam: UMat.
  • method: RobotWorldHandEyeCalibrationMethod.

Computes Robot-World/Hand-Eye calibration: \f$_{}^{w}\textrm{T}_b\f$ and \f$_{}^{c}\textrm{T}_g\f$

Positional Arguments
  • r_world2cam: vector_UMat.
  • t_world2cam: vector_UMat.
  • r_base2gripper: vector_UMat.
  • t_base2gripper: vector_UMat.
Keyword Arguments
  • r_base2world: UMat.
  • t_base2world: UMat.
  • r_gripper2cam: UMat.
  • t_gripper2cam: UMat.
  • method: RobotWorldHandEyeCalibrationMethod.

Computes Robot-World/Hand-Eye calibration: \f$_{}^{w}\textrm{T}_b\f$ and \f$_{}^{c}\textrm{T}_g\f$

Computes useful camera characteristics from the camera intrinsic matrix.

Finds an object center, size, and orientation.

Positional Arguments
  • image: UMat.
  • threshold1: double.
  • threshold2: double.
Keyword Arguments
  • edges: UMat.
  • apertureSize: int.
  • l2gradient: bool.

Finds edges in an image using the Canny algorithm @cite Canny86 . The function finds edges in the input image and marks them in the output map edges using the Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The largest value is used to find initial segments of strong edges. See http://en.wikipedia.org/wiki/Canny_edge_detector

Variaint 1:

Positional Arguments
  • dx: UMat.
  • dy: UMat.
  • threshold1: double.
  • threshold2: double.
Keyword Arguments
  • edges: UMat.

Positional Arguments
  • dx: UMat.
  • dy: UMat.
  • threshold1: double.
  • threshold2: double.
Keyword Arguments
  • edges: UMat.

Positional Arguments
  • x: UMat.
  • y: UMat.
Keyword Arguments
  • magnitude: UMat.
  • angle: UMat.
  • angleInDegrees: bool.

Calculates the magnitude and angle of 2D vectors. The function cv::cartToPolar calculates either the magnitude, angle, or both for every 2D vector (x(I),y(I)): \f[\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}\f] The angles are calculated with accuracy about 0.3 degrees. For the point (0,0), the angle is set to 0.

Positional Arguments
  • x: UMat.
  • y: UMat.
Keyword Arguments
  • magnitude: UMat.
  • angle: UMat.
  • angleInDegrees: bool.

Calculates the magnitude and angle of 2D vectors. The function cv::cartToPolar calculates either the magnitude, angle, or both for every 2D vector (x(I),y(I)): \f[\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}\f] The angles are calculated with accuracy about 0.3 degrees. For the point (0,0), the angle is set to 0.

Python prototype (for reference):

Returns true if the specified feature is supported by the host hardware. The function returns true if the host hardware supports the specified feature. When user calls setUseOptimized(false), the subsequent calls to checkHardwareSupport() will return false until setUseOptimized(true) is called. This way user can dynamically switch on and off the optimized code in OpenCV.

Positional Arguments
  • a: UMat.
Keyword Arguments
  • quiet: bool.
  • minVal: double.
  • maxVal: double.

Checks every element of an input array for invalid values. The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal > -DBL_MAX and maxVal \< DBL_MAX, the function also checks that each value is between minVal and maxVal. In case of multi-channel arrays, each channel is processed independently. If some values are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the function either returns false (when quiet=true) or throws an exception.

Positional Arguments
  • a: UMat.
Keyword Arguments
  • quiet: bool.
  • minVal: double.
  • maxVal: double.

Checks every element of an input array for invalid values. The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal > -DBL_MAX and maxVal \< DBL_MAX, the function also checks that each value is between minVal and maxVal. In case of multi-channel arrays, each channel is processed independently. If some values are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the function either returns false (when quiet=true) or throws an exception.

Positional Arguments
  • img: UMat.
  • center: Point.
  • radius: int.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a circle. The function cv::circle draws a simple or filled circle with a given center and radius.

Positional Arguments
  • img: UMat.
  • center: Point.
  • radius: int.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a circle. The function cv::circle draws a simple or filled circle with a given center and radius.

Has overloading in C++

Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.
  • red_mul: float.
  • green_mul: float.
  • blue_mul: float.

Given an original color image, two differently colored versions of this image can be mixed seamlessly. Multiplication factor is between .5 to 2.5.

Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.
  • red_mul: float.
  • green_mul: float.
  • blue_mul: float.

Given an original color image, two differently colored versions of this image can be mixed seamlessly. Multiplication factor is between .5 to 2.5.

Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • cmpop: int.
Keyword Arguments
  • dst: UMat.

Performs the per-element comparison of two arrays or an array and scalar value. The function compares

Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • cmpop: int.
Keyword Arguments
  • dst: UMat.

Performs the per-element comparison of two arrays or an array and scalar value. The function compares

Compares two histograms. The function cv::compareHist compares two dense or two sparse histograms using the specified method. The function returns \f$d(H_1, H_2)\f$ . While the function works well with 1-, 2-, 3-dimensional dense histograms, it may not be suitable for high-dimensional sparse histograms. In such histograms, because of aliasing and sampling problems, the coordinates of non-zero histogram bins can slightly shift. To compare such histograms or more general sparse configurations of weighted points, consider using the #EMD function.

Positional Arguments
  • m: UMat.
Keyword Arguments
  • lowerToUpper: bool.

Copies the lower or the upper half of a square matrix to its another half. The function cv::completeSymm copies the lower or the upper half of a square matrix to its another half. The matrix diagonal remains unchanged

Positional Arguments
  • m: UMat.
Keyword Arguments
  • lowerToUpper: bool.

Copies the lower or the upper half of a square matrix to its another half. The function cv::completeSymm copies the lower or the upper half of a square matrix to its another half. The matrix diagonal remains unchanged

Positional Arguments
  • rvec1: UMat.
  • tvec1: UMat.
  • rvec2: UMat.
  • tvec2: UMat.
Keyword Arguments
  • rvec3: UMat.
  • tvec3: UMat.
  • dr3dr1: UMat.
  • dr3dt1: UMat.
  • dr3dr2: UMat.
  • dr3dt2: UMat.
  • dt3dr1: UMat.
  • dt3dt1: UMat.
  • dt3dr2: UMat.
  • dt3dt2: UMat.

Combines two rotation-and-shift transformations. The functions compute: \f[\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\f] where \f$\mathrm{rodrigues}\f$ denotes a rotation vector to a rotation matrix transformation, and \f$\mathrm{rodrigues}^{-1}\f$ denotes the inverse transformation. See Rodrigues for details. Also, the functions can compute the derivatives of the output vectors with regards to the input vectors (see matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a function that contains a matrix multiplication.

Positional Arguments
  • rvec1: UMat.
  • tvec1: UMat.
  • rvec2: UMat.
  • tvec2: UMat.
Keyword Arguments
  • rvec3: UMat.
  • tvec3: UMat.
  • dr3dr1: UMat.
  • dr3dt1: UMat.
  • dr3dr2: UMat.
  • dr3dt2: UMat.
  • dt3dr1: UMat.
  • dt3dt1: UMat.
  • dt3dr2: UMat.
  • dt3dt2: UMat.

Combines two rotation-and-shift transformations. The functions compute: \f[\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\f] where \f$\mathrm{rodrigues}\f$ denotes a rotation vector to a rotation matrix transformation, and \f$\mathrm{rodrigues}^{-1}\f$ denotes the inverse transformation. See Rodrigues for details. Also, the functions can compute the derivatives of the output vectors with regards to the input vectors (see matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a function that contains a matrix multiplication.

Positional Arguments
  • points: UMat.
  • whichImage: int.
  • f: UMat.
Keyword Arguments
  • lines: UMat.

For points in an image of a stereo pair, computes the corresponding epilines in the other image.

Positional Arguments
  • points: UMat.
  • whichImage: int.
  • f: UMat.
Keyword Arguments
  • lines: UMat.

For points in an image of a stereo pair, computes the corresponding epilines in the other image.

Positional Arguments
  • templateImage: UMat.
  • inputImage: UMat.
Keyword Arguments
  • inputMask: UMat.

Computes the Enhanced Correlation Coefficient value between two images @cite EP08 .

Positional Arguments
  • templateImage: UMat.
  • inputImage: UMat.
Keyword Arguments
  • inputMask: UMat.

Computes the Enhanced Correlation Coefficient value between two images @cite EP08 .

Positional Arguments
  • image: UMat.
Keyword Arguments
  • labels: UMat.
  • connectivity: int.
  • ltype: int.

Has overloading in C++

Positional Arguments
  • image: UMat.
Keyword Arguments
  • labels: UMat.
  • connectivity: int.
  • ltype: int.

Has overloading in C++

Positional Arguments
  • image: UMat.
  • connectivity: int.
  • ltype: int.
  • ccltype: int.
Keyword Arguments
  • labels: UMat.

computes the connected components labeled image of boolean image image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while Spaghetti and BBDT do not. This function uses parallel version of the algorithms if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.

Positional Arguments
  • image: UMat.
  • connectivity: int.
  • ltype: int.
  • ccltype: int.
Keyword Arguments
  • labels: UMat.

computes the connected components labeled image of boolean image image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while Spaghetti and BBDT do not. This function uses parallel version of the algorithms if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.

Positional Arguments
  • image: UMat.
Keyword Arguments
  • labels: UMat.
  • stats: UMat.
  • centroids: UMat.
  • connectivity: int.
  • ltype: int.

Has overloading in C++

Positional Arguments
  • image: UMat.
Keyword Arguments
  • labels: UMat.
  • stats: UMat.
  • centroids: UMat.
  • connectivity: int.
  • ltype: int.

Has overloading in C++

Positional Arguments
  • image: UMat.
  • connectivity: int.
  • ltype: int.
  • ccltype: int.
Keyword Arguments
  • labels: UMat.
  • stats: UMat.
  • centroids: UMat.

computes the connected components labeled image of boolean image and also produces a statistics output for each label image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while Spaghetti and BBDT do not. This function uses parallel version of the algorithms (statistics included) if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.

Positional Arguments
  • image: UMat.
  • connectivity: int.
  • ltype: int.
  • ccltype: int.
Keyword Arguments
  • labels: UMat.
  • stats: UMat.
  • centroids: UMat.

computes the connected components labeled image of boolean image and also produces a statistics output for each label image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while Spaghetti and BBDT do not. This function uses parallel version of the algorithms (statistics included) if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.

Positional Arguments
  • contour: UMat.
Keyword Arguments
  • oriented: bool.

Calculates a contour area. The function computes a contour area. Similarly to moments , the area is computed using the Green formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using #drawContours or #fillPoly , can be different. Also, the function will most certainly give a wrong results for contours with self-intersections. Example

Positional Arguments
  • contour: UMat.
Keyword Arguments
  • oriented: bool.

Calculates a contour area. The function computes a contour area. Similarly to moments , the area is computed using the Green formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using #drawContours or #fillPoly , can be different. Also, the function will most certainly give a wrong results for contours with self-intersections. Example

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Converts an array to half precision floating number. This function converts FP32 (single precision floating point) from/to FP16 (half precision floating point). CV_16S format is used to represent FP16 data. There are two use modes (src -> dst): CV_32F -> CV_16S and CV_16S -> CV_32F. The input array has to have type of CV_32F or CV_16S to represent the bit depth. If the input array is neither of them, the function will raise an error. The format of half precision floating point is defined in IEEE 754-2008.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Converts an array to half precision floating number. This function converts FP32 (single precision floating point) from/to FP16 (half precision floating point). CV_16S format is used to represent FP16 data. There are two use modes (src -> dst): CV_32F -> CV_16S and CV_16S -> CV_32F. The input array has to have type of CV_32F or CV_16S to represent the bit depth. If the input array is neither of them, the function will raise an error. The format of half precision floating point is defined in IEEE 754-2008.

Positional Arguments
  • map1: UMat.
  • map2: UMat.
  • dstmap1type: int.
Keyword Arguments
  • dstmap1: UMat.
  • dstmap2: UMat.
  • nninterpolation: bool.

Converts image transformation maps from one representation to another. The function converts a pair of maps for remap from one representation to another. The following options ( (map1.type(), map2.type()) \f$\rightarrow\f$ (dstmap1.type(), dstmap2.type()) ) are supported

Positional Arguments
  • map1: UMat.
  • map2: UMat.
  • dstmap1type: int.
Keyword Arguments
  • dstmap1: UMat.
  • dstmap2: UMat.
  • nninterpolation: bool.

Converts image transformation maps from one representation to another. The function converts a pair of maps for remap from one representation to another. The following options ( (map1.type(), map2.type()) \f$\rightarrow\f$ (dstmap1.type(), dstmap2.type()) ) are supported

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Converts points from homogeneous to Euclidean space. The function converts points homogeneous to Euclidean space using perspective projection. That is, each point (x1, x2, ... x(n-1), xn) is converted to (x1/xn, x2/xn, ..., x(n-1)/xn). When xn=0, the output point coordinates will be (0,0,0,...).

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Converts points from homogeneous to Euclidean space. The function converts points homogeneous to Euclidean space using perspective projection. That is, each point (x1, x2, ... x(n-1), xn) is converted to (x1/xn, x2/xn, ..., x(n-1)/xn). When xn=0, the output point coordinates will be (0,0,0,...).

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Converts points from Euclidean to homogeneous space. The function converts points from Euclidean to homogeneous space by appending 1's to the tuple of point coordinates. That is, each point (x1, x2, ..., xn) is converted to (x1, x2, ..., xn, 1).

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Converts points from Euclidean to homogeneous space. The function converts points from Euclidean to homogeneous space by appending 1's to the tuple of point coordinates. That is, each point (x1, x2, ..., xn) is converted to (x1, x2, ..., xn, 1).

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • alpha: double.
  • beta: double.

Scales, calculates absolute values, and converts the result to 8-bit. On each element of the input array, the function convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type: \f[\texttt{dst} (I)= \texttt{saturate\_cast<uchar>} (| \texttt{src} (I)* \texttt{alpha} + \texttt{beta} |)\f] In case of multi-channel arrays, the function processes each channel independently. When the output is not 8-bit, the operation can be emulated by calling the Mat::convertTo method (or by using matrix expressions) and then by calculating an absolute value of the result. For example

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • alpha: double.
  • beta: double.

Scales, calculates absolute values, and converts the result to 8-bit. On each element of the input array, the function convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type: \f[\texttt{dst} (I)= \texttt{saturate\_cast<uchar>} (| \texttt{src} (I)* \texttt{alpha} + \texttt{beta} |)\f] In case of multi-channel arrays, the function processes each channel independently. When the output is not 8-bit, the operation can be emulated by calling the Mat::convertTo method (or by using matrix expressions) and then by calculating an absolute value of the result. For example

Positional Arguments
  • points: UMat.
Keyword Arguments
  • hull: UMat.
  • clockwise: bool.
  • returnPoints: bool.

Finds the convex hull of a point set. The function cv::convexHull finds the convex hull of a 2D point set using the Sklansky's algorithm @cite Sklansky82 that has O(N logN) complexity in the current implementation.

Positional Arguments
  • points: UMat.
Keyword Arguments
  • hull: UMat.
  • clockwise: bool.
  • returnPoints: bool.

Finds the convex hull of a point set. The function cv::convexHull finds the convex hull of a 2D point set using the Sklansky's algorithm @cite Sklansky82 that has O(N logN) complexity in the current implementation.

Positional Arguments
  • contour: UMat.
  • convexhull: UMat.
Keyword Arguments
  • convexityDefects: UMat.

Finds the convexity defects of a contour. The figure below displays convexity defects of a hand contour: image

Positional Arguments
  • contour: UMat.
  • convexhull: UMat.
Keyword Arguments
  • convexityDefects: UMat.

Finds the convexity defects of a contour. The figure below displays convexity defects of a hand contour: image

Positional Arguments
  • src: UMat.
  • top: int.
  • bottom: int.
  • left: int.
  • right: int.
  • borderType: int.
Keyword Arguments
  • dst: UMat.
  • value: Scalar.

Forms a border around an image. The function copies the source image into the middle of the destination image. The areas to the left, to the right, above and below the copied source image will be filled with extrapolated pixels. This is not what filtering functions based on it do (they extrapolate pixels on-fly), but what other more complex functions, including your own, may do to simplify image boundary handling. The function supports the mode when src is already in the middle of dst . In this case, the function does not copy src itself but simply constructs the border, for example

Positional Arguments
  • src: UMat.
  • top: int.
  • bottom: int.
  • left: int.
  • right: int.
  • borderType: int.
Keyword Arguments
  • dst: UMat.
  • value: Scalar.

Forms a border around an image. The function copies the source image into the middle of the destination image. The areas to the left, to the right, above and below the copied source image will be filled with extrapolated pixels. This is not what filtering functions based on it do (they extrapolate pixels on-fly), but what other more complex functions, including your own, may do to simplify image boundary handling. The function supports the mode when src is already in the middle of dst . In this case, the function does not copy src itself but simply constructs the border, for example

Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.

This is an overloaded member function, provided for convenience (python) Copies the matrix to another one. When the operation mask is specified, if the Mat::create call shown above reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data.

Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.

This is an overloaded member function, provided for convenience (python) Copies the matrix to another one. When the operation mask is specified, if the Mat::create call shown above reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data.

Positional Arguments
  • src: UMat.
  • blockSize: int.
  • ksize: int.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Calculates eigenvalues and eigenvectors of image blocks for corner detection. For every pixel \f$p\f$ , the function cornerEigenValsAndVecs considers a blockSize \f$\times\f$ blockSize neighborhood \f$S(p)\f$ . It calculates the covariation matrix of derivatives over the neighborhood as: \f[M = \begin{bmatrix} \sum _{S(p)}(dI/dx)^2 & \sum _{S(p)}dI/dx dI/dy \\ \sum _{S(p)}dI/dx dI/dy & \sum _{S(p)}(dI/dy)^2 \end{bmatrix}\f] where the derivatives are computed using the Sobel operator. After that, it finds eigenvectors and eigenvalues of \f$M\f$ and stores them in the destination image as \f$(\lambda_1, \lambda_2, x_1, y_1, x_2, y_2)\f$ where

Positional Arguments
  • src: UMat.
  • blockSize: int.
  • ksize: int.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Calculates eigenvalues and eigenvectors of image blocks for corner detection. For every pixel \f$p\f$ , the function cornerEigenValsAndVecs considers a blockSize \f$\times\f$ blockSize neighborhood \f$S(p)\f$ . It calculates the covariation matrix of derivatives over the neighborhood as: \f[M = \begin{bmatrix} \sum _{S(p)}(dI/dx)^2 & \sum _{S(p)}dI/dx dI/dy \\ \sum _{S(p)}dI/dx dI/dy & \sum _{S(p)}(dI/dy)^2 \end{bmatrix}\f] where the derivatives are computed using the Sobel operator. After that, it finds eigenvectors and eigenvalues of \f$M\f$ and stores them in the destination image as \f$(\lambda_1, \lambda_2, x_1, y_1, x_2, y_2)\f$ where

Positional Arguments
  • src: UMat.
  • blockSize: int.
  • ksize: int.
  • k: double.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Harris corner detector. The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and cornerEigenValsAndVecs , for each pixel \f$(x, y)\f$ it calculates a \f$2\times2\f$ gradient covariance matrix \f$M^{(x,y)}\f$ over a \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood. Then, it computes the following characteristic: \f[\texttt{dst} (x,y) = \mathrm{det} M^{(x,y)} - k \cdot \left ( \mathrm{tr} M^{(x,y)} \right )^2\f] Corners in the image can be found as the local maxima of this response map.

Positional Arguments
  • src: UMat.
  • blockSize: int.
  • ksize: int.
  • k: double.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Harris corner detector. The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and cornerEigenValsAndVecs , for each pixel \f$(x, y)\f$ it calculates a \f$2\times2\f$ gradient covariance matrix \f$M^{(x,y)}\f$ over a \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood. Then, it computes the following characteristic: \f[\texttt{dst} (x,y) = \mathrm{det} M^{(x,y)} - k \cdot \left ( \mathrm{tr} M^{(x,y)} \right )^2\f] Corners in the image can be found as the local maxima of this response map.

Positional Arguments
  • src: UMat.
  • blockSize: int.
Keyword Arguments
  • dst: UMat.
  • ksize: int.
  • borderType: int.

Calculates the minimal eigenvalue of gradient matrices for corner detection. The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal eigenvalue of the covariance matrix of derivatives, that is, \f$\min(\lambda_1, \lambda_2)\f$ in terms of the formulae in the cornerEigenValsAndVecs description.

Positional Arguments
  • src: UMat.
  • blockSize: int.
Keyword Arguments
  • dst: UMat.
  • ksize: int.
  • borderType: int.

Calculates the minimal eigenvalue of gradient matrices for corner detection. The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal eigenvalue of the covariance matrix of derivatives, that is, \f$\min(\lambda_1, \lambda_2)\f$ in terms of the formulae in the cornerEigenValsAndVecs description.

Refines the corner locations. The function iterates to find the sub-pixel accurate location of corners or radial saddle points as described in @cite forstner1987fast, and as shown on the figure below. image Sub-pixel accurate corner locator is based on the observation that every vector from the center \f$q\f$ to a point \f$p\f$ located within a neighborhood of \f$q\f$ is orthogonal to the image gradient at \f$p\f$ subject to image and measurement noise. Consider the expression: \f[\epsilon _i = {DI_{p_i}}^T \cdot (q - p_i)\f] where \f${DI_{p_i}}\f$ is an image gradient at one of the points \f$p_i\f$ in a neighborhood of \f$q\f$ . The value of \f$q\f$ is to be found so that \f$\epsilon_i\f$ is minimized. A system of equations may be set up with \f$\epsilon_i\f$ set to zero: \f[\sum _i(DI_{p_i} \cdot {DI_{p_i}}^T) \cdot q - \sum _i(DI_{p_i} \cdot {DI_{p_i}}^T \cdot p_i)\f] where the gradients are summed within a neighborhood ("search window") of \f$q\f$ . Calling the first gradient term \f$G\f$ and the second gradient term \f$b\f$ gives: \f[q = G^{-1} \cdot b\f] The algorithm sets the center of the neighborhood window at this new center \f$q\f$ and then iterates until the center stays within a set threshold.

Positional Arguments
  • f: UMat.
  • points1: UMat.
  • points2: UMat.
Keyword Arguments
  • newPoints1: UMat.
  • newPoints2: UMat.

Refines coordinates of corresponding points. The function implements the Optimal Triangulation Method (see Multiple View Geometry for details). For each given point correspondence points1[i] \<-> points2[i], and a fundamental matrix F, it computes the corrected correspondences newPoints1[i] \<-> newPoints2[i] that minimize the geometric error \f$d(points1[i], newPoints1[i])^2 + d(points2[i],newPoints2[i])^2\f$ (where \f$d(a,b)\f$ is the geometric distance between points \f$a\f$ and \f$b\f$ ) subject to the epipolar constraint \f$newPoints2^T * F * newPoints1 = 0\f$ .

Positional Arguments
  • f: UMat.
  • points1: UMat.
  • points2: UMat.
Keyword Arguments
  • newPoints1: UMat.
  • newPoints2: UMat.

Refines coordinates of corresponding points. The function implements the Optimal Triangulation Method (see Multiple View Geometry for details). For each given point correspondence points1[i] \<-> points2[i], and a fundamental matrix F, it computes the corrected correspondences newPoints1[i] \<-> newPoints2[i] that minimize the geometric error \f$d(points1[i], newPoints1[i])^2 + d(points2[i],newPoints2[i])^2\f$ (where \f$d(a,b)\f$ is the geometric distance between points \f$a\f$ and \f$b\f$ ) subject to the epipolar constraint \f$newPoints2^T * F * newPoints1 = 0\f$ .

Counts non-zero array elements. The function returns the number of non-zero elements in src : \f[\sum _{I: \; \texttt{src} (I) \ne0 } 1\f] @sa mean, meanStdDev, norm, minMaxLoc, calcCovarMatrix

Positional Arguments
Keyword Arguments
  • max_bits: int.
  • exclude_range: int.
  • cut: bool.

Creates AlignMTB object

Positional Arguments
Keyword Arguments
  • max_bits: int.
  • exclude_range: int.
  • cut: bool.

Creates AlignMTB object

Positional Arguments
Keyword Arguments
  • history: int.
  • dist2Threshold: double.
  • detectShadows: bool.

Creates KNN Background Subtractor

Positional Arguments
Keyword Arguments
  • history: int.
  • dist2Threshold: double.
  • detectShadows: bool.

Creates KNN Background Subtractor

Positional Arguments
Keyword Arguments
  • history: int.
  • varThreshold: double.
  • detectShadows: bool.

Creates MOG2 Background Subtractor

Positional Arguments
Keyword Arguments
  • history: int.
  • varThreshold: double.
  • detectShadows: bool.

Creates MOG2 Background Subtractor

Positional Arguments
Keyword Arguments
  • samples: int.
  • lambda: float.
  • random: bool.

Creates CalibrateDebevec object

Positional Arguments
Keyword Arguments
  • samples: int.
  • lambda: float.
  • random: bool.

Creates CalibrateDebevec object

Positional Arguments
Keyword Arguments
  • max_iter: int.
  • threshold: float.

Creates CalibrateRobertson object

Positional Arguments
Keyword Arguments
  • max_iter: int.
  • threshold: float.

Creates CalibrateRobertson object

Positional Arguments
Keyword Arguments
  • clipLimit: double.
  • tileGridSize: Size.

Creates a smart pointer to a cv::CLAHE class and initializes it.

Positional Arguments
Keyword Arguments
  • clipLimit: double.
  • tileGridSize: Size.

Creates a smart pointer to a cv::CLAHE class and initializes it.

Creates a smart pointer to a cv::GeneralizedHoughBallard class and initializes it.

Creates a smart pointer to a cv::GeneralizedHoughGuil class and initializes it.

Positional Arguments
  • winSize: Size.
  • type: int.
Keyword Arguments
  • dst: UMat.

This function computes a Hanning window coefficients in two dimensions. See (http://en.wikipedia.org/wiki/Hann_function) and (http://en.wikipedia.org/wiki/Window_function) for more information. An example is shown below

Positional Arguments
  • winSize: Size.
  • type: int.
Keyword Arguments
  • dst: UMat.

This function computes a Hanning window coefficients in two dimensions. See (http://en.wikipedia.org/wiki/Hann_function) and (http://en.wikipedia.org/wiki/Window_function) for more information. An example is shown below

Positional Arguments
Keyword Arguments
  • refine: int.
  • scale: double.
  • sigma_scale: double.
  • quant: double.
  • ang_th: double.
  • log_eps: double.
  • density_th: double.
  • n_bins: int.

Creates a smart pointer to a LineSegmentDetector object and initializes it. The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want to edit those, as to tailor it for their own application.

Positional Arguments
Keyword Arguments
  • refine: int.
  • scale: double.
  • sigma_scale: double.
  • quant: double.
  • ang_th: double.
  • log_eps: double.
  • density_th: double.
  • n_bins: int.

Creates a smart pointer to a LineSegmentDetector object and initializes it. The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want to edit those, as to tailor it for their own application.

Creates MergeDebevec object

Positional Arguments
Keyword Arguments
  • contrast_weight: float.
  • saturation_weight: float.
  • exposure_weight: float.

Creates MergeMertens object

Positional Arguments
Keyword Arguments
  • contrast_weight: float.
  • saturation_weight: float.
  • exposure_weight: float.

Creates MergeMertens object

Creates MergeRobertson object

Positional Arguments
Keyword Arguments
  • gamma: float.

Creates simple linear mapper with gamma correction

Positional Arguments
Keyword Arguments
  • gamma: float.

Creates simple linear mapper with gamma correction

Positional Arguments
Keyword Arguments
  • gamma: float.
  • saturation: float.
  • bias: float.

Creates TonemapDrago object

Positional Arguments
Keyword Arguments
  • gamma: float.
  • saturation: float.
  • bias: float.

Creates TonemapDrago object

Positional Arguments
Keyword Arguments
  • gamma: float.
  • scale: float.
  • saturation: float.

Creates TonemapMantiuk object

Positional Arguments
Keyword Arguments
  • gamma: float.
  • scale: float.
  • saturation: float.

Creates TonemapMantiuk object

Positional Arguments
Keyword Arguments
  • gamma: float.
  • intensity: float.
  • light_adapt: float.
  • color_adapt: float.

Creates TonemapReinhard object

Positional Arguments
Keyword Arguments
  • gamma: float.
  • intensity: float.
  • light_adapt: float.
  • color_adapt: float.

Creates TonemapReinhard object

Computes the cube root of an argument. The function cubeRoot computes \f$\sqrt[3]{\texttt{val}}\f$. Negative arguments are handled correctly. NaN and Inf are not handled. The accuracy approaches the maximum possible accuracy for single-precision data.

Positional Arguments
  • src: UMat.
  • code: int.
Keyword Arguments
  • dst: UMat.
  • dstCn: int.

Converts an image from one color space to another. The function converts an input image from one color space to another. In case of a transformation to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on. The conventional ranges for R, G, and B channel values are

Positional Arguments
  • src: UMat.
  • code: int.
Keyword Arguments
  • dst: UMat.
  • dstCn: int.

Converts an image from one color space to another. The function converts an input image from one color space to another. In case of a transformation to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on. The conventional ranges for R, G, and B channel values are

Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • code: int.
Keyword Arguments
  • dst: UMat.

Converts an image from one color space to another where the source image is stored in two planes. This function only supports YUV420 to RGB conversion as of now.

Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • code: int.
Keyword Arguments
  • dst: UMat.

Converts an image from one color space to another where the source image is stored in two planes. This function only supports YUV420 to RGB conversion as of now.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Performs a forward or inverse discrete Cosine transform of 1D or 2D array. The function cv::dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D floating-point array

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Performs a forward or inverse discrete Cosine transform of 1D or 2D array. The function cv::dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D floating-point array

Positional Arguments
  • src: UMat.
Keyword Arguments
  • grayscale: UMat.
  • color_boost: UMat.

Transforms a color image to a grayscale image. It is a basic tool in digital printing, stylized black-and-white photograph rendering, and in many single channel image processing applications @cite CL12 . This function is to be applied on color images.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • grayscale: UMat.
  • color_boost: UMat.

Transforms a color image to a grayscale image. It is a basic tool in digital printing, stylized black-and-white photograph rendering, and in many single channel image processing applications @cite CL12 . This function is to be applied on color images.

Positional Arguments
  • e: UMat.
Keyword Arguments
  • r1: UMat.
  • r2: UMat.
  • t: UMat.

Decompose an essential matrix to possible rotations and translation. This function decomposes the essential matrix E using svd decomposition @cite HartleyZ00. In general, four possible poses exist for the decomposition of E. They are \f$[R_1, t]\f$, \f$[R_1, -t]\f$, \f$[R_2, t]\f$, \f$[R_2, -t]\f$. If E gives the epipolar constraint \f$[p_2; 1]^T A^{-T} E A^{-1} [p_1; 1] = 0\f$ between the image points \f$p_1\f$ in the first image and \f$p_2\f$ in second image, then any of the tuples \f$[R_1, t]\f$, \f$[R_1, -t]\f$, \f$[R_2, t]\f$, \f$[R_2, -t]\f$ is a change of basis from the first camera's coordinate system to the second camera's coordinate system. However, by decomposing E, one can only get the direction of the translation. For this reason, the translation t is returned with unit length.

Positional Arguments
  • e: UMat.
Keyword Arguments
  • r1: UMat.
  • r2: UMat.
  • t: UMat.

Decompose an essential matrix to possible rotations and translation. This function decomposes the essential matrix E using svd decomposition @cite HartleyZ00. In general, four possible poses exist for the decomposition of E. They are \f$[R_1, t]\f$, \f$[R_1, -t]\f$, \f$[R_2, t]\f$, \f$[R_2, -t]\f$. If E gives the epipolar constraint \f$[p_2; 1]^T A^{-T} E A^{-1} [p_1; 1] = 0\f$ between the image points \f$p_1\f$ in the first image and \f$p_2\f$ in second image, then any of the tuples \f$[R_1, t]\f$, \f$[R_1, -t]\f$, \f$[R_2, t]\f$, \f$[R_2, -t]\f$ is a change of basis from the first camera's coordinate system to the second camera's coordinate system. However, by decomposing E, one can only get the direction of the translation. For this reason, the translation t is returned with unit length.

Positional Arguments
  • h: UMat.
  • k: UMat.
Keyword Arguments
  • rotations: vector_UMat.
  • translations: vector_UMat.
  • normals: vector_UMat.

Decompose a homography matrix to rotation(s), translation(s) and plane normal(s). This function extracts relative camera motion between two views of a planar object and returns up to four mathematical solution tuples of rotation, translation, and plane normal. The decomposition of the homography matrix H is described in detail in @cite Malis. If the homography H, induced by the plane, gives the constraint \f[s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\f] on the source image points \f$p_i\f$ and the destination image points \f$p'_i\f$, then the tuple of rotations[k] and translations[k] is a change of basis from the source camera's coordinate system to the destination camera's coordinate system. However, by decomposing H, one can only get the translation normalized by the (typically unknown) depth of the scene, i.e. its direction but with normalized length. If point correspondences are available, at least two solutions may further be invalidated, by applying positive depth constraint, i.e. all points must be in front of the camera.

Positional Arguments
  • h: UMat.
  • k: UMat.
Keyword Arguments
  • rotations: vector_UMat.
  • translations: vector_UMat.
  • normals: vector_UMat.

Decompose a homography matrix to rotation(s), translation(s) and plane normal(s). This function extracts relative camera motion between two views of a planar object and returns up to four mathematical solution tuples of rotation, translation, and plane normal. The decomposition of the homography matrix H is described in detail in @cite Malis. If the homography H, induced by the plane, gives the constraint \f[s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\f] on the source image points \f$p_i\f$ and the destination image points \f$p'_i\f$, then the tuple of rotations[k] and translations[k] is a change of basis from the source camera's coordinate system to the destination camera's coordinate system. However, by decomposing H, one can only get the translation normalized by the (typically unknown) depth of the scene, i.e. its direction but with normalized length. If point correspondences are available, at least two solutions may further be invalidated, by applying positive depth constraint, i.e. all points must be in front of the camera.

Positional Arguments
  • projMatrix: UMat.
Keyword Arguments
  • cameraMatrix: UMat.
  • rotMatrix: UMat.
  • transVect: UMat.
  • rotMatrixX: UMat.
  • rotMatrixY: UMat.
  • rotMatrixZ: UMat.
  • eulerAngles: UMat.

Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.

Positional Arguments
  • projMatrix: UMat.
Keyword Arguments
  • cameraMatrix: UMat.
  • rotMatrix: UMat.
  • transVect: UMat.
  • rotMatrixX: UMat.
  • rotMatrixY: UMat.
  • rotMatrixZ: UMat.
  • eulerAngles: UMat.

Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.

Positional Arguments
  • src: UMat.
  • code: int.
Keyword Arguments
  • dst: UMat.
  • dstCn: int.

main function for all demosaicing processes

Positional Arguments
  • src: UMat.
  • code: int.
Keyword Arguments
  • dst: UMat.
  • dstCn: int.

main function for all demosaicing processes

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • sigma_s: float.
  • sigma_r: float.

This filter enhances the details of a particular image.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • sigma_s: float.
  • sigma_r: float.

This filter enhances the details of a particular image.

Returns the determinant of a square floating-point matrix. The function cv::determinant calculates and returns the determinant of the specified matrix. For small matrices ( mtx.cols=mtx.rows\<=3 ), the direct method is used. For larger matrices, the function uses LU factorization with partial pivoting. For symmetric positively-determined matrices, it is also possible to use eigen decomposition to calculate the determinant.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • nonzeroRows: int.

Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array. The function cv::dft performs one of the following

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • nonzeroRows: int.

Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array. The function cv::dft performs one of the following

Positional Arguments
  • src: UMat.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • iterations: int.
  • borderType: int.
  • borderValue: Scalar.

Dilates an image by using a specific structuring element. The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken: \f[\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.

Positional Arguments
  • src: UMat.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • iterations: int.
  • borderType: int.
  • borderValue: Scalar.

Dilates an image by using a specific structuring element. The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken: \f[\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.

Positional Arguments
  • winname: String.
  • text: String.
Keyword Arguments
  • delayms: int.

Displays a text on a window image as an overlay for a specified duration. The function displayOverlay displays useful information/tips on top of the window for a certain amount of time delayms. The function does not modify the image, displayed in the window, that is, after the specified delay the original content of the window is restored.

Positional Arguments
  • winname: String.
  • text: String.
Keyword Arguments
  • delayms: int.

Displays a text on a window image as an overlay for a specified duration. The function displayOverlay displays useful information/tips on top of the window for a certain amount of time delayms. The function does not modify the image, displayed in the window, that is, after the specified delay the original content of the window is restored.

Positional Arguments
  • winname: String.
  • text: String.
Keyword Arguments
  • delayms: int.

Displays a text on the window statusbar during the specified period of time. The function displayStatusBar displays useful information/tips on top of the window for a certain amount of time delayms . This information is displayed on the window statusbar (the window must be created with the CV_GUI_EXPANDED flags).

Positional Arguments
  • winname: String.
  • text: String.
Keyword Arguments
  • delayms: int.

Displays a text on the window statusbar during the specified period of time. The function displayStatusBar displays useful information/tips on top of the window for a certain amount of time delayms . This information is displayed on the window statusbar (the window must be created with the CV_GUI_EXPANDED flags).

Positional Arguments
  • src: UMat.
  • distanceType: int.
  • maskSize: int.
Keyword Arguments
  • dst: UMat.
  • dstType: int.

Has overloading in C++

Positional Arguments
  • src: UMat.
  • distanceType: int.
  • maskSize: int.
Keyword Arguments
  • dst: UMat.
  • dstType: int.

Has overloading in C++

Positional Arguments
  • src: UMat.
  • distanceType: int.
  • maskSize: int.
Keyword Arguments
  • dst: UMat.
  • labels: UMat.
  • labelType: int.

Calculates the distance to the closest zero pixel for each pixel of the source image. The function cv::distanceTransform calculates the approximate or precise distance from every binary image pixel to the nearest zero pixel. For zero image pixels, the distance will obviously be zero. When maskSize == #DIST_MASK_PRECISE and distanceType == #DIST_L2 , the function runs the algorithm described in @cite Felzenszwalb04 . This algorithm is parallelized with the TBB library. In other cases, the algorithm @cite Borgefors86 is used. This means that for a pixel the function finds the shortest path to the nearest zero pixel consisting of basic shifts: horizontal, vertical, diagonal, or knight's move (the latest is available for a \f$5\times 5\f$ mask). The overall distance is calculated as a sum of these basic distances. Since the distance function should be symmetric, all of the horizontal and vertical shifts must have the same cost (denoted as a ), all the diagonal shifts must have the same cost (denoted as b), and all knight's moves must have the same cost (denoted as c). For the #DIST_C and #DIST_L1 types, the distance is calculated precisely, whereas for #DIST_L2 (Euclidean distance) the distance can be calculated only with a relative error (a \f$5\times 5\f$ mask gives more accurate results). For a,b, and c, OpenCV uses the values suggested in the original paper

Positional Arguments
  • src: UMat.
  • distanceType: int.
  • maskSize: int.
Keyword Arguments
  • dst: UMat.
  • labels: UMat.
  • labelType: int.

Calculates the distance to the closest zero pixel for each pixel of the source image. The function cv::distanceTransform calculates the approximate or precise distance from every binary image pixel to the nearest zero pixel. For zero image pixels, the distance will obviously be zero. When maskSize == #DIST_MASK_PRECISE and distanceType == #DIST_L2 , the function runs the algorithm described in @cite Felzenszwalb04 . This algorithm is parallelized with the TBB library. In other cases, the algorithm @cite Borgefors86 is used. This means that for a pixel the function finds the shortest path to the nearest zero pixel consisting of basic shifts: horizontal, vertical, diagonal, or knight's move (the latest is available for a \f$5\times 5\f$ mask). The overall distance is calculated as a sum of these basic distances. Since the distance function should be symmetric, all of the horizontal and vertical shifts must have the same cost (denoted as a ), all the diagonal shifts must have the same cost (denoted as b), and all knight's moves must have the same cost (denoted as c). For the #DIST_C and #DIST_L1 types, the distance is calculated precisely, whereas for #DIST_L2 (Euclidean distance) the distance can be calculated only with a relative error (a \f$5\times 5\f$ mask gives more accurate results). For a,b, and c, OpenCV uses the values suggested in the original paper

Variaint 1:

Positional Arguments
  • scale: double
  • src2: UMat
Keyword Arguments
  • dst: UMat.
  • dtype: int.

Has overloading in C++

Variaint 1:

Positional Arguments
  • scale: double
  • src2: UMat
Keyword Arguments
  • dst: UMat.
  • dtype: int.

Has overloading in C++

Positional Arguments
  • a: UMat.
  • b: UMat.
  • flags: int.
Keyword Arguments
  • c: UMat.
  • conjB: bool.

Performs the per-element division of the first Fourier spectrum by the second Fourier spectrum. The function cv::divSpectrums performs the per-element division of the first array by the second array. The arrays are CCS-packed or complex matrices that are results of a real or complex Fourier transform.

Positional Arguments
  • a: UMat.
  • b: UMat.
  • flags: int.
Keyword Arguments
  • c: UMat.
  • conjB: bool.

Performs the per-element division of the first Fourier spectrum by the second Fourier spectrum. The function cv::divSpectrums performs the per-element division of the first array by the second array. The arrays are CCS-packed or complex matrices that are results of a real or complex Fourier transform.

Positional Arguments
  • image: UMat.
  • contours: vector_UMat.
  • contourIdx: int.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • hierarchy: UMat.
  • maxLevel: int.
  • offset: Point.

Draws contours outlines or filled contours. The function draws contour outlines in the image if \f$\texttt{thickness} \ge 0\f$ or fills the area bounded by the contours if \f$\texttt{thickness}<0\f$ . The example below shows how to retrieve connected components from the binary image and label them: : @include snippets/imgproc_drawContours.cpp

Positional Arguments
  • image: UMat.
  • contours: vector_UMat.
  • contourIdx: int.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • hierarchy: UMat.
  • maxLevel: int.
  • offset: Point.

Draws contours outlines or filled contours. The function draws contour outlines in the image if \f$\texttt{thickness} \ge 0\f$ or fills the area bounded by the contours if \f$\texttt{thickness}<0\f$ . The example below shows how to retrieve connected components from the binary image and label them: : @include snippets/imgproc_drawContours.cpp

Positional Arguments
  • image: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • rvec: UMat.
  • tvec: UMat.
  • length: float.
Keyword Arguments
  • thickness: int.

Draw axes of the world/object coordinate system from pose estimation. @sa solvePnP

Positional Arguments
  • image: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • rvec: UMat.
  • tvec: UMat.
  • length: float.
Keyword Arguments
  • thickness: int.

Draw axes of the world/object coordinate system from pose estimation. @sa solvePnP

Positional Arguments
  • image: UMat.
  • keypoints: vector_KeyPoint.
  • outImage: UMat.
Keyword Arguments
  • color: Scalar.
  • flags: DrawMatchesFlags.

Draws keypoints.

Positional Arguments
  • image: UMat.
  • keypoints: vector_KeyPoint.
  • outImage: UMat.
Keyword Arguments
  • color: Scalar.
  • flags: DrawMatchesFlags.

Draws keypoints.

Positional Arguments
  • img: UMat. Image.
  • position: Point.
  • color: Scalar.
Keyword Arguments
  • markerType: int.
  • markerSize: int.
  • thickness: int.
  • line_type: int.

Draws a marker on a predefined position in an image. The function cv::drawMarker draws a marker on a given position in the image. For the moment several marker types are supported, see #MarkerTypes for more information.

Positional Arguments
  • img: UMat. Image.
  • position: Point.
  • color: Scalar.
Keyword Arguments
  • markerType: int.
  • markerSize: int.
  • thickness: int.
  • line_type: int.

Draws a marker on a predefined position in an image. The function cv::drawMarker draws a marker on a given position in the image. For the moment several marker types are supported, see #MarkerTypes for more information.

Positional Arguments
  • img1: UMat.
  • keypoints1: vector_KeyPoint.
  • img2: UMat.
  • keypoints2: vector_KeyPoint.
  • matches1to2: vector_DMatch.
  • outImg: UMat.
Keyword Arguments
  • matchColor: Scalar.
  • singlePointColor: Scalar.
  • matchesMask: vector_char.
  • flags: DrawMatchesFlags.

Draws the found matches of keypoints from two images.

Variaint 1:

Positional Arguments
  • img1: UMat
  • keypoints1: vector_KeyPoint
  • img2: UMat
  • keypoints2: vector_KeyPoint
  • matches1to2: vector_DMatch
  • outImg: UMat
  • matchesThickness: int
Keyword Arguments
  • matchColor: Scalar.
  • singlePointColor: Scalar.
  • matchesMask: vector_char.
  • flags: DrawMatchesFlags.

Has overloading in C++

Positional Arguments
  • img1: UMat
  • keypoints1: vector_KeyPoint
  • img2: UMat
  • keypoints2: vector_KeyPoint
  • matches1to2: vector_DMatch
  • outImg: UMat
  • matchesThickness: int
Keyword Arguments
  • matchColor: Scalar.
  • singlePointColor: Scalar.
  • matchesMask: vector_char.
  • flags: DrawMatchesFlags.

Has overloading in C++

Positional Arguments
  • img1: UMat
  • keypoints1: vector_KeyPoint
  • img2: UMat
  • keypoints2: vector_KeyPoint
  • matches1to2: vector_vector_DMatch
  • outImg: UMat
Keyword Arguments
  • matchColor: Scalar.
  • singlePointColor: Scalar.
  • matchesMask: vector_vector_char.
  • flags: DrawMatchesFlags.

Python prototype (for reference):

Positional Arguments
  • img1: UMat
  • keypoints1: vector_KeyPoint
  • img2: UMat
  • keypoints2: vector_KeyPoint
  • matches1to2: vector_vector_DMatch
  • outImg: UMat
Keyword Arguments
  • matchColor: Scalar.
  • singlePointColor: Scalar.
  • matchesMask: vector_vector_char.
  • flags: DrawMatchesFlags.

Python prototype (for reference):

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • sigma_s: float.
  • sigma_r: float.

Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing filters are used in many different applications @cite EM11 .

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • sigma_s: float.
  • sigma_r: float.

Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing filters are used in many different applications @cite EM11 .

Positional Arguments
  • src: UMat.
Keyword Arguments
  • eigenvalues: UMat.
  • eigenvectors: UMat.

Calculates eigenvalues and eigenvectors of a symmetric matrix. The function cv::eigen calculates just eigenvalues, or eigenvalues and eigenvectors of the symmetric matrix src

Positional Arguments
  • src: UMat.
Keyword Arguments
  • eigenvalues: UMat.
  • eigenvectors: UMat.

Calculates eigenvalues and eigenvectors of a symmetric matrix. The function cv::eigen calculates just eigenvalues, or eigenvalues and eigenvectors of the symmetric matrix src

Positional Arguments
  • src: UMat.
Keyword Arguments
  • eigenvalues: UMat.
  • eigenvectors: UMat.

Calculates eigenvalues and eigenvectors of a non-symmetric matrix (real eigenvalues only). Note: Assumes real eigenvalues. The function calculates eigenvalues and eigenvectors (optional) of the square matrix src

Positional Arguments
  • src: UMat.
Keyword Arguments
  • eigenvalues: UMat.
  • eigenvectors: UMat.

Calculates eigenvalues and eigenvectors of a non-symmetric matrix (real eigenvalues only). Note: Assumes real eigenvalues. The function calculates eigenvalues and eigenvectors (optional) of the square matrix src

Approximates an elliptic arc with a polyline. The function ellipse2Poly computes the vertices of a polyline that approximates the specified elliptic arc. It is used by #ellipse. If arcStart is greater than arcEnd, they are swapped.

Positional Arguments
  • img: UMat. Image.
  • box: RotatedRect.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.

Has overloading in C++

Positional Arguments
  • img: UMat. Image.
  • box: RotatedRect.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.

Has overloading in C++

Positional Arguments
  • img: UMat. Image.
  • center: Point.
  • axes: Size.
  • angle: double.
  • startAngle: double.
  • endAngle: double.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a simple or thick elliptic arc or fills an ellipse sector. The function cv::ellipse with more parameters draws an ellipse outline, a filled ellipse, an elliptic arc, or a filled ellipse sector. The drawing code uses general parametric form. A piecewise-linear curve is used to approximate the elliptic arc boundary. If you need more control of the ellipse rendering, you can retrieve the curve using #ellipse2Poly and then render it with #polylines or fill it with #fillPoly. If you use the first variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and endAngle=360. If startAngle is greater than endAngle, they are swapped. The figure below explains the meaning of the parameters to draw the blue arc. Parameters of Elliptic Arc

Positional Arguments
  • img: UMat. Image.
  • center: Point.
  • axes: Size.
  • angle: double.
  • startAngle: double.
  • endAngle: double.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a simple or thick elliptic arc or fills an ellipse sector. The function cv::ellipse with more parameters draws an ellipse outline, a filled ellipse, an elliptic arc, or a filled ellipse sector. The drawing code uses general parametric form. A piecewise-linear curve is used to approximate the elliptic arc boundary. If you need more control of the ellipse rendering, you can retrieve the curve using #ellipse2Poly and then render it with #polylines or fill it with #fillPoly. If you use the first variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and endAngle=360. If startAngle is greater than endAngle, they are swapped. The figure below explains the meaning of the parameters to draw the blue arc. Parameters of Elliptic Arc

Positional Arguments
  • signature1: UMat.
  • signature2: UMat.
  • distType: int.
Keyword Arguments
  • cost: UMat.
  • lowerBound: Ptr<float>.
  • flow: UMat.

Computes the "minimal work" distance between two weighted point configurations. The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations. One of the applications described in @cite RubnerSept98, @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval. EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster. In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object.

Positional Arguments
  • signature1: UMat.
  • signature2: UMat.
  • distType: int.
Keyword Arguments
  • cost: UMat.
  • lowerBound: Ptr<float>.
  • flow: UMat.

Computes the "minimal work" distance between two weighted point configurations. The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations. One of the applications described in @cite RubnerSept98, @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval. EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster. In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Equalizes the histogram of a grayscale image. The function equalizes the histogram of the input image using the following algorithm

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Equalizes the histogram of a grayscale image. The function equalizes the histogram of the input image using the following algorithm

Positional Arguments
  • src: UMat.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • iterations: int.
  • borderType: int.
  • borderValue: Scalar.

Erodes an image by using a specific structuring element. The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken: \f[\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.

Positional Arguments
  • src: UMat.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • iterations: int.
  • borderType: int.
  • borderValue: Scalar.

Erodes an image by using a specific structuring element. The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken: \f[\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.

Positional Arguments
  • from: UMat.
  • to: UMat.
Keyword Arguments
  • inliers: UMat.
  • method: int.
  • ransacReprojThreshold: double.
  • maxIters: size_t.
  • confidence: double.
  • refineIters: size_t.

Computes an optimal affine transformation between two 2D point sets. It computes \f[ \begin{bmatrix} x\\ y\\ \end{bmatrix} \begin{bmatrix} a_{11} & a_{12}\\ a_{21} & a_{22}\\ \end{bmatrix} \begin{bmatrix} X\\ Y\\ \end{bmatrix} + \begin{bmatrix} b_1\\ b_2\\ \end{bmatrix} \f]

Variaint 1:

Positional Arguments
  • pts1: UMat
  • pts2: UMat
  • params: UsacParams
Keyword Arguments
  • inliers: UMat.

Python prototype (for reference):

Positional Arguments
  • pts1: UMat
  • pts2: UMat
  • params: UsacParams
Keyword Arguments
  • inliers: UMat.

Python prototype (for reference):

Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • force_rotation: bool.

Computes an optimal affine transformation between two 3D point sets. It computes \f$R,s,t\f$ minimizing \f$\sum{i} dst_i - c \cdot R \cdot src_i \f$ where \f$R\f$ is a 3x3 rotation matrix, \f$t\f$ is a 3x1 translation vector and \f$s\f$ is a scalar size value. This is an implementation of the algorithm by Umeyama \cite umeyama1991least . The estimated affine transform has a homogeneous scale which is a subclass of affine transformations with 7 degrees of freedom. The paired point sets need to comprise at least 3 points each.

Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • force_rotation: bool.

Computes an optimal affine transformation between two 3D point sets. It computes \f$R,s,t\f$ minimizing \f$\sum{i} dst_i - c \cdot R \cdot src_i \f$ where \f$R\f$ is a 3x3 rotation matrix, \f$t\f$ is a 3x1 translation vector and \f$s\f$ is a scalar size value. This is an implementation of the algorithm by Umeyama \cite umeyama1991least . The estimated affine transform has a homogeneous scale which is a subclass of affine transformations with 7 degrees of freedom. The paired point sets need to comprise at least 3 points each.

Positional Arguments
  • from: UMat.
  • to: UMat.
Keyword Arguments
  • inliers: UMat.
  • method: int.
  • ransacReprojThreshold: double.
  • maxIters: size_t.
  • confidence: double.
  • refineIters: size_t.

Computes an optimal limited affine transformation with 4 degrees of freedom between two 2D point sets.

Positional Arguments
  • from: UMat.
  • to: UMat.
Keyword Arguments
  • inliers: UMat.
  • method: int.
  • ransacReprojThreshold: double.
  • maxIters: size_t.
  • confidence: double.
  • refineIters: size_t.

Computes an optimal limited affine transformation with 4 degrees of freedom between two 2D point sets.

Positional Arguments
  • image: UMat.
  • patternSize: Size.
  • corners: UMat.
Keyword Arguments
  • rise_distance: float.
  • vertical: bool.
  • sharpness: UMat.

Estimates the sharpness of a detected chessboard. Image sharpness, as well as brightness, are a critical parameter for accuracte camera calibration. For accessing these parameters for filtering out problematic calibraiton images, this method calculates edge profiles by traveling from black to white chessboard cell centers. Based on this, the number of pixels is calculated required to transit from black to white. This width of the transition area is a good indication of how sharp the chessboard is imaged and should be below ~3.0 pixels. The optional sharpness array is of type CV_32FC1 and has for each calculated profile one row with the following five entries: 0 = x coordinate of the underlying edge in the image 1 = y coordinate of the underlying edge in the image 2 = width of the transition area (sharpness) 3 = signal strength in the black cell (min brightness) 4 = signal strength in the white cell (max brightness) @return Scalar(average sharpness, average min brightness, average max brightness,0)

Positional Arguments
  • image: UMat.
  • patternSize: Size.
  • corners: UMat.
Keyword Arguments
  • rise_distance: float.
  • vertical: bool.
  • sharpness: UMat.

Estimates the sharpness of a detected chessboard. Image sharpness, as well as brightness, are a critical parameter for accuracte camera calibration. For accessing these parameters for filtering out problematic calibraiton images, this method calculates edge profiles by traveling from black to white chessboard cell centers. Based on this, the number of pixels is calculated required to transit from black to white. This width of the transition area is a good indication of how sharp the chessboard is imaged and should be below ~3.0 pixels. The optional sharpness array is of type CV_32FC1 and has for each calculated profile one row with the following five entries: 0 = x coordinate of the underlying edge in the image 1 = y coordinate of the underlying edge in the image 2 = width of the transition area (sharpness) 3 = signal strength in the black cell (min brightness) 4 = signal strength in the white cell (max brightness) @return Scalar(average sharpness, average min brightness, average max brightness,0)

Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • out: UMat.
  • inliers: UMat.
  • ransacThreshold: double.
  • confidence: double.

Computes an optimal translation between two 3D point sets. It computes \f[ \begin{bmatrix} x\\ y\\ z\\ \end{bmatrix} \begin{bmatrix} X\\ Y\\ Z\\ \end{bmatrix} + \begin{bmatrix} b_1\\ b_2\\ b_3\\ \end{bmatrix} \f]

Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • out: UMat.
  • inliers: UMat.
  • ransacThreshold: double.
  • confidence: double.

Computes an optimal translation between two 3D point sets. It computes \f[ \begin{bmatrix} x\\ y\\ z\\ \end{bmatrix} \begin{bmatrix} X\\ Y\\ Z\\ \end{bmatrix} + \begin{bmatrix} b_1\\ b_2\\ b_3\\ \end{bmatrix} \f]

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the exponent of every array element. The function cv::exp calculates the exponent of every element of the input array: \f[\texttt{dst} [I] = e^{ src(I) }\f] The maximum relative error is about 7e-6 for single-precision input and less than 1e-10 for double-precision input. Currently, the function converts denormalized values to zeros on output. Special values (NaN, Inf) are not handled. @sa log , cartToPolar , polarToCart , phase , pow , sqrt , magnitude

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the exponent of every array element. The function cv::exp calculates the exponent of every element of the input array: \f[\texttt{dst} [I] = e^{ src(I) }\f] The maximum relative error is about 7e-6 for single-precision input and less than 1e-10 for double-precision input. Currently, the function converts denormalized values to zeros on output. Special values (NaN, Inf) are not handled. @sa log , cartToPolar , polarToCart , phase , pow , sqrt , magnitude

Positional Arguments
  • src: UMat.
  • coi: int.
Keyword Arguments
  • dst: UMat.

Extracts a single channel from src (coi is 0-based index) @sa mixChannels, split

Positional Arguments
  • src: UMat.
  • coi: int.
Keyword Arguments
  • dst: UMat.

Extracts a single channel from src (coi is 0-based index) @sa mixChannels, split

Calculates the angle of a 2D vector in degrees. The function fastAtan2 calculates the full-range angle of an input 2D vector. The angle is measured in degrees and varies from 0 to 360 degrees. The accuracy is about 0.3 degrees.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/ with several computational optimizations. Noise expected to be a gaussian white noise

Variaint 1:

Positional Arguments
  • src: UMat.
  • h: vector_float.
Keyword Arguments
  • dst: UMat.
  • templateWindowSize: int.
  • searchWindowSize: int.
  • normType: int.

Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/ with several computational optimizations. Noise expected to be a gaussian white noise

Positional Arguments
  • src: UMat.
  • h: vector_float.
Keyword Arguments
  • dst: UMat.
  • templateWindowSize: int.
  • searchWindowSize: int.
  • normType: int.

Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/ with several computational optimizations. Noise expected to be a gaussian white noise

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • hColor: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Modification of fastNlMeansDenoising function for colored images

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • hColor: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Modification of fastNlMeansDenoising function for colored images

Positional Arguments
  • srcImgs: vector_UMat.
  • imgToDenoiseIndex: int.
  • temporalWindowSize: int.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • hColor: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Modification of fastNlMeansDenoisingMulti function for colored images sequences

Positional Arguments
  • srcImgs: vector_UMat.
  • imgToDenoiseIndex: int.
  • temporalWindowSize: int.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • hColor: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Modification of fastNlMeansDenoisingMulti function for colored images sequences

Positional Arguments
  • srcImgs: vector_UMat.
  • imgToDenoiseIndex: int.
  • temporalWindowSize: int.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Modification of fastNlMeansDenoising function for images sequence where consecutive images have been captured in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. For more details see http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394

Variaint 1:

Positional Arguments
  • srcImgs: vector_UMat.
  • imgToDenoiseIndex: int.
  • temporalWindowSize: int.
  • h: vector_float.
Keyword Arguments
  • dst: UMat.
  • templateWindowSize: int.
  • searchWindowSize: int.
  • normType: int.

Modification of fastNlMeansDenoising function for images sequence where consecutive images have been captured in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. For more details see http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394

Positional Arguments
  • srcImgs: vector_UMat.
  • imgToDenoiseIndex: int.
  • temporalWindowSize: int.
  • h: vector_float.
Keyword Arguments
  • dst: UMat.
  • templateWindowSize: int.
  • searchWindowSize: int.
  • normType: int.

Modification of fastNlMeansDenoising function for images sequence where consecutive images have been captured in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. For more details see http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394

Positional Arguments
  • img: UMat. Image.
  • points: UMat.
  • color: Scalar.
Keyword Arguments
  • lineType: int.
  • shift: int.

Fills a convex polygon. The function cv::fillConvexPoly draws a filled convex polygon. This function is much faster than the function #fillPoly . It can fill not only convex polygons but any monotonic polygon without self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line) twice at the most (though, its top-most and/or the bottom edge could be horizontal).

Positional Arguments
  • img: UMat. Image.
  • points: UMat.
  • color: Scalar.
Keyword Arguments
  • lineType: int.
  • shift: int.

Fills a convex polygon. The function cv::fillConvexPoly draws a filled convex polygon. This function is much faster than the function #fillPoly . It can fill not only convex polygons but any monotonic polygon without self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line) twice at the most (though, its top-most and/or the bottom edge could be horizontal).

Positional Arguments
  • img: UMat. Image.
  • pts: vector_UMat.
  • color: Scalar.
Keyword Arguments
  • lineType: int.
  • shift: int.
  • offset: Point.

Fills the area bounded by one or more polygons. The function cv::fillPoly fills an area bounded by several polygonal contours. The function can fill complex areas, for example, areas with holes, contours with self-intersections (some of their parts), and so forth.

Positional Arguments
  • img: UMat. Image.
  • pts: vector_UMat.
  • color: Scalar.
Keyword Arguments
  • lineType: int.
  • shift: int.
  • offset: Point.

Fills the area bounded by one or more polygons. The function cv::fillPoly fills an area bounded by several polygonal contours. The function can fill complex areas, for example, areas with holes, contours with self-intersections (some of their parts), and so forth.

Positional Arguments
  • src: UMat.
  • ddepth: int.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • delta: double.
  • borderType: int.

Convolves an image with the kernel. The function applies an arbitrary linear filter to an image. In-place operation is supported. When the aperture is partially outside the image, the function interpolates outlier pixel values according to the specified border mode. The function does actually compute correlation, not the convolution: \f[\texttt{dst} (x,y) = \sum _{ \substack{0\leq x' < \texttt{kernel.cols}\\{0\leq y' < \texttt{kernel.rows}}}} \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\f] That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip the kernel using #flip and set the new anchor to (kernel.cols - anchor.x - 1, kernel.rows - anchor.y - 1). The function uses the DFT-based algorithm in case of sufficiently large kernels (~11 x 11 or larger) and the direct algorithm for small kernels.

Positional Arguments
  • src: UMat.
  • ddepth: int.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • delta: double.
  • borderType: int.

Convolves an image with the kernel. The function applies an arbitrary linear filter to an image. In-place operation is supported. When the aperture is partially outside the image, the function interpolates outlier pixel values according to the specified border mode. The function does actually compute correlation, not the convolution: \f[\texttt{dst} (x,y) = \sum _{ \substack{0\leq x' < \texttt{kernel.cols}\\{0\leq y' < \texttt{kernel.rows}}}} \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\f] That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip the kernel using #flip and set the new anchor to (kernel.cols - anchor.x - 1, kernel.rows - anchor.y - 1). The function uses the DFT-based algorithm in case of sufficiently large kernels (~11 x 11 or larger) and the direct algorithm for small kernels.

Positional Arguments
  • rotations: vector_UMat.
  • normals: vector_UMat.
  • beforePoints: UMat.
  • afterPoints: UMat.
Keyword Arguments
  • possibleSolutions: UMat.
  • pointsMask: UMat.

Filters homography decompositions based on additional information. This function is intended to filter the output of the #decomposeHomographyMat based on additional information as described in @cite Malis . The summary of the method: the #decomposeHomographyMat function returns 2 unique solutions and their "opposites" for a total of 4 solutions. If we have access to the sets of points visible in the camera frame before and after the homography transformation is applied, we can determine which are the true potential solutions and which are the opposites by verifying which homographies are consistent with all visible reference points being in front of the camera. The inputs are left unchanged; the filtered solution set is returned as indices into the existing one.

Positional Arguments
  • rotations: vector_UMat.
  • normals: vector_UMat.
  • beforePoints: UMat.
  • afterPoints: UMat.
Keyword Arguments
  • possibleSolutions: UMat.
  • pointsMask: UMat.

Filters homography decompositions based on additional information. This function is intended to filter the output of the #decomposeHomographyMat based on additional information as described in @cite Malis . The summary of the method: the #decomposeHomographyMat function returns 2 unique solutions and their "opposites" for a total of 4 solutions. If we have access to the sets of points visible in the camera frame before and after the homography transformation is applied, we can determine which are the true potential solutions and which are the opposites by verifying which homographies are consistent with all visible reference points being in front of the camera. The inputs are left unchanged; the filtered solution set is returned as indices into the existing one.

Positional Arguments
  • img: UMat.
  • newVal: double.
  • maxSpeckleSize: int.
  • maxDiff: double.
Keyword Arguments
  • buf: UMat.

Filters off small noise blobs (speckles) in the disparity map

Positional Arguments
  • img: UMat.
  • newVal: double.
  • maxSpeckleSize: int.
  • maxDiff: double.
Keyword Arguments
  • buf: UMat.

Filters off small noise blobs (speckles) in the disparity map

Python prototype (for reference):

Positional Arguments
  • image: UMat.
  • patternSize: Size.
Keyword Arguments
  • corners: UMat.
  • flags: int.

Finds the positions of internal corners of the chessboard.

Positional Arguments
  • image: UMat.
  • patternSize: Size.
Keyword Arguments
  • corners: UMat.
  • flags: int.

Finds the positions of internal corners of the chessboard.

Positional Arguments
  • image: UMat
  • patternSize: Size
Keyword Arguments
  • corners: UMat.
  • flags: int.

Has overloading in C++

Positional Arguments
  • image: UMat
  • patternSize: Size
Keyword Arguments
  • corners: UMat.
  • flags: int.

Has overloading in C++

Positional Arguments
  • image: UMat.
  • patternSize: Size.
  • flags: int.
Keyword Arguments
  • corners: UMat.
  • meta: UMat.

Finds the positions of internal corners of the chessboard using a sector based approach.

Positional Arguments
  • image: UMat.
  • patternSize: Size.
  • flags: int.
Keyword Arguments
  • corners: UMat.
  • meta: UMat.

Finds the positions of internal corners of the chessboard using a sector based approach.

Positional Arguments
  • image: UMat
  • patternSize: Size
Keyword Arguments
  • centers: UMat.
  • flags: int.
  • blobDetector: Ptr<FeatureDetector>.

Has overloading in C++

Positional Arguments
  • image: UMat
  • patternSize: Size
Keyword Arguments
  • centers: UMat.
  • flags: int.
  • blobDetector: Ptr<FeatureDetector>.

Has overloading in C++

Positional Arguments
  • image: UMat.
  • patternSize: Size.
  • flags: int.
  • blobDetector: Ptr<FeatureDetector>.
  • parameters: CirclesGridFinderParameters.
Keyword Arguments
  • centers: UMat.

Finds centers in the grid of circles.

Positional Arguments
  • image: UMat.
  • patternSize: Size.
  • flags: int.
  • blobDetector: Ptr<FeatureDetector>.
  • parameters: CirclesGridFinderParameters.
Keyword Arguments
  • centers: UMat.

Finds centers in the grid of circles.

Positional Arguments
  • image: UMat.
  • mode: int.
  • method: int.
Keyword Arguments
  • contours: vector_UMat.
  • hierarchy: UMat.
  • offset: Point.

Finds contours in a binary image. The function retrieves contours from the binary image using the algorithm @cite Suzuki85 . The contours are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the OpenCV sample directory. Note: Since opencv 3.2 source image is not modified by this function.

Positional Arguments
  • image: UMat.
  • mode: int.
  • method: int.
Keyword Arguments
  • contours: vector_UMat.
  • hierarchy: UMat.
  • offset: Point.

Finds contours in a binary image. The function retrieves contours from the binary image using the algorithm @cite Suzuki85 . The contours are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the OpenCV sample directory. Note: Since opencv 3.2 source image is not modified by this function.

Positional Arguments
  • points1: UMat.
  • points2: UMat.
Keyword Arguments
  • focal: double.
  • pp: Point2d.
  • method: int.
  • prob: double.
  • threshold: double.
  • maxIters: int.
  • mask: UMat.

Has overloading in C++

Variaint 1:

Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix: UMat.
Keyword Arguments
  • method: int.
  • prob: double.
  • threshold: double.
  • maxIters: int.
  • mask: UMat.

Calculates an essential matrix from the corresponding points in two images.

Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix: UMat.
Keyword Arguments
  • method: int.
  • prob: double.
  • threshold: double.
  • maxIters: int.
  • mask: UMat.

Calculates an essential matrix from the corresponding points in two images.

Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
Keyword Arguments
  • method: int.
  • prob: double.
  • threshold: double.
  • mask: UMat.

Calculates an essential matrix from the corresponding points in two images from potentially two different cameras.

Variaint 1:

Positional Arguments
  • points1: UMat
  • points2: UMat
  • cameraMatrix1: UMat
  • cameraMatrix2: UMat
  • dist_coeff1: UMat
  • dist_coeff2: UMat
  • params: UsacParams
Keyword Arguments
  • mask: UMat.

Python prototype (for reference):

Positional Arguments
  • points1: UMat
  • points2: UMat
  • cameraMatrix1: UMat
  • cameraMatrix2: UMat
  • dist_coeff1: UMat
  • dist_coeff2: UMat
  • params: UsacParams
Keyword Arguments
  • mask: UMat.

Python prototype (for reference):

Positional Arguments
  • points1: UMat
  • points2: UMat
Keyword Arguments
  • method: int.
  • ransacReprojThreshold: double.
  • confidence: double.
  • mask: UMat.

Has overloading in C++

Variaint 1:

Positional Arguments
  • points1: UMat
  • points2: UMat
  • params: UsacParams
Keyword Arguments
  • mask: UMat.

Has overloading in C++

Positional Arguments
  • points1: UMat
  • points2: UMat
  • params: UsacParams
Keyword Arguments
  • mask: UMat.

Has overloading in C++

Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • method: int.
  • ransacReprojThreshold: double.
  • confidence: double.
  • maxIters: int.
Keyword Arguments
  • mask: UMat.

Calculates a fundamental matrix from the corresponding points in two images.

Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • method: int.
  • ransacReprojThreshold: double.
  • confidence: double.
  • maxIters: int.
Keyword Arguments
  • mask: UMat.

Calculates a fundamental matrix from the corresponding points in two images.

Positional Arguments
  • srcPoints: UMat.
  • dstPoints: UMat.
Keyword Arguments
  • method: int.
  • ransacReprojThreshold: double.
  • mask: UMat.
  • maxIters: int.
  • confidence: double.

Finds a perspective transformation between two planes.

Variaint 1:

Positional Arguments
  • srcPoints: UMat
  • dstPoints: UMat
  • params: UsacParams
Keyword Arguments
  • mask: UMat.

Has overloading in C++

Positional Arguments
  • srcPoints: UMat
  • dstPoints: UMat
  • params: UsacParams
Keyword Arguments
  • mask: UMat.

Has overloading in C++

Positional Arguments
  • src: UMat.
Keyword Arguments
  • idx: UMat.

Returns the list of locations of non-zero pixels Given a binary matrix (likely returned from an operation such as threshold(), compare(), >, ==, etc, return all of the non-zero indices as a cv::Mat or std::vector<cv::Point> (x,y) For example

Positional Arguments
  • src: UMat.
Keyword Arguments
  • idx: UMat.

Returns the list of locations of non-zero pixels Given a binary matrix (likely returned from an operation such as threshold(), compare(), >, ==, etc, return all of the non-zero indices as a cv::Mat or std::vector<cv::Point> (x,y) For example

Positional Arguments
  • templateImage: UMat
  • inputImage: UMat
  • warpMatrix: UMat
Keyword Arguments
  • motionType: int.
  • criteria: TermCriteria.
  • inputMask: UMat.

Has overloading in C++

Positional Arguments
  • templateImage: UMat
  • inputImage: UMat
  • warpMatrix: UMat
Keyword Arguments
  • motionType: int.
  • criteria: TermCriteria.
  • inputMask: UMat.

Has overloading in C++

Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 .

Fits an ellipse around a set of 2D points. The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of all. It returns the rotated rectangle in which the ellipse is inscribed. The first algorithm described by @cite Fitzgibbon95 is used. Developer should keep in mind that it is possible that the returned ellipse/rotatedRect data contains negative indices, due to the data points being close to the border of the containing Mat element.

Fits an ellipse around a set of 2D points. The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle in which the ellipse is inscribed. The Approximate Mean Square (AMS) proposed by @cite Taubin1991 is used. For an ellipse, this basis set is \f$ \chi= \left(x^2, x y, y^2, x, y, 1\right) \f$, which is a set of six free coefficients \f$ A^T=\left\{A_{\text{xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\} \f$. However, to specify an ellipse, all that is needed is five numbers; the major and minor axes lengths \f$ (a,b) \f$, the position \f$ (x_0,y_0) \f$, and the orientation \f$ \theta \f$. This is because the basis set includes lines, quadratics, parabolic and hyperbolic functions as well as elliptical functions as possible fits. If the fit is found to be a parabolic or hyperbolic function then the standard #fitEllipse method is used. The AMS method restricts the fit to parabolic, hyperbolic and elliptical curves by imposing the condition that \f$ A^T ( D_x^T D_x + D_y^T D_y) A = 1 \f$ where the matrices \f$ Dx \f$ and \f$ Dy \f$ are the partial derivatives of the design matrix \f$ D \f$ with respect to x and y. The matrices are formed row by row applying the following to each of the points in the set: \f{align}{ D(i,:)&=\left{x_i^2, x_i y_i, y_i^2, x_i, y_i, 1\right} & D_x(i,:)&=\left{2 x_i,y_i,0,1,0,0\right} & D_y(i,:)&=\left{0,x_i,2 y_i,0,1,0\right} \f} The AMS method minimizes the cost function \f{equation}{ \epsilon ^2=\frac{ A^T D^T D A }{ A^T (D_x^T D_x + D_y^T D_y) A^T } \f} The minimum cost is found by solving the generalized eigenvalue problem. \f{equation*}{ D^T D A = \lambda \left( D_x^T D_x + D_y^T D_y\right) A \f}

Fits an ellipse around a set of 2D points. The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle in which the ellipse is inscribed. The Direct least square (Direct) method by @cite Fitzgibbon1999 is used. For an ellipse, this basis set is \f$ \chi= \left(x^2, x y, y^2, x, y, 1\right) \f$, which is a set of six free coefficients \f$ A^T=\left\{A_{\text{xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\} \f$. However, to specify an ellipse, all that is needed is five numbers; the major and minor axes lengths \f$ (a,b) \f$, the position \f$ (x_0,y_0) \f$, and the orientation \f$ \theta \f$. This is because the basis set includes lines, quadratics, parabolic and hyperbolic functions as well as elliptical functions as possible fits. The Direct method confines the fit to ellipses by ensuring that \f$ 4 A_{xx} A_{yy}- A_{xy}^2 > 0 \f$. The condition imposed is that \f$ 4 A_{xx} A_{yy}- A_{xy}^2=1 \f$ which satisfies the inequality and as the coefficients can be arbitrarily scaled is not overly restrictive. \f{equation}{ \epsilon ^2= A^T D^T D A \quad \text{with} \quad A^T C A =1 \quad \text{and} \quad C=\left(\begin{matrix} 0 & 0 & 2 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 & 0 & 0 \\ 2 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \end{matrix} \right) \f} The minimum cost is found by solving the generalized eigenvalue problem. \f{equation}{ D^T D A = \lambda \left( C\right) A \f} The system produces only one positive eigenvalue \f$ \lambda\f$ which is chosen as the solution with its eigenvector \f$\mathbf{u}\f$. These are used to find the coefficients \f{equation*}{ A = \sqrt{\frac{1}{\mathbf{u}^T C \mathbf{u}}} \mathbf{u} \f} The scaling factor guarantees that \f$A^T C A =1\f$.

Positional Arguments
  • points: UMat.
  • distType: int.
  • param: double.
  • reps: double.
  • aeps: double.
Keyword Arguments
  • line: UMat.

Fits a line to a 2D or 3D point set. The function fitLine fits a line to a 2D or 3D point set by minimizing \f$\sum_i \rho(r_i)\f$ where \f$r_i\f$ is a distance between the \f$i^{th}\f$ point, the line and \f$\rho(r)\f$ is a distance function, one of the following

Positional Arguments
  • points: UMat.
  • distType: int.
  • param: double.
  • reps: double.
  • aeps: double.
Keyword Arguments
  • line: UMat.

Fits a line to a 2D or 3D point set. The function fitLine fits a line to a 2D or 3D point set by minimizing \f$\sum_i \rho(r_i)\f$ where \f$r_i\f$ is a distance between the \f$i^{th}\f$ point, the line and \f$\rho(r)\f$ is a distance function, one of the following

Positional Arguments
  • src: UMat.
  • flipCode: int.
Keyword Arguments
  • dst: UMat.

Flips a 2D array around vertical, horizontal, or both axes. The function cv::flip flips the array in one of three different ways (row and column indices are 0-based): \f[\texttt{dst} _{ij} = \left\{ \begin{array}{l l} \texttt{src} _{\texttt{src.rows}-i-1,j} & if\; \texttt{flipCode} = 0 \\ \texttt{src} _{i, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} > 0 \\ \texttt{src} _{ \texttt{src.rows} -i-1, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} < 0 \\ \end{array} \right.\f] The example scenarios of using the function are the following

Positional Arguments
  • src: UMat.
  • flipCode: int.
Keyword Arguments
  • dst: UMat.

Flips a 2D array around vertical, horizontal, or both axes. The function cv::flip flips the array in one of three different ways (row and column indices are 0-based): \f[\texttt{dst} _{ij} = \left\{ \begin{array}{l l} \texttt{src} _{\texttt{src.rows}-i-1,j} & if\; \texttt{flipCode} = 0 \\ \texttt{src} _{i, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} > 0 \\ \texttt{src} _{ \texttt{src.rows} -i-1, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} < 0 \\ \end{array} \right.\f] The example scenarios of using the function are the following

Positional Arguments
  • image: UMat.
  • mask: UMat.
  • seedPoint: Point.
  • newVal: Scalar.
Keyword Arguments
  • loDiff: Scalar.
  • upDiff: Scalar.
  • flags: int.

Fills a connected component with the given color. The function cv::floodFill fills a connected component starting from the seed point with the specified color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The pixel at \f$(x,y)\f$ is considered to belong to the repainted domain if

Positional Arguments
  • image: UMat.
  • mask: UMat.
  • seedPoint: Point.
  • newVal: Scalar.
Keyword Arguments
  • loDiff: Scalar.
  • upDiff: Scalar.
  • flags: int.

Fills a connected component with the given color. The function cv::floodFill fills a connected component starting from the seed point with the specified color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The pixel at \f$(x,y)\f$ is considered to belong to the repainted domain if

Positional Arguments
  • src: UMat.
  • ksize: Size.
  • sigmaX: double.
Keyword Arguments
  • dst: UMat.
  • sigmaY: double.
  • borderType: int.

Blurs an image using a Gaussian filter. The function convolves the source image with the specified Gaussian kernel. In-place filtering is supported.

Positional Arguments
  • src: UMat.
  • ksize: Size.
  • sigmaX: double.
Keyword Arguments
  • dst: UMat.
  • sigmaY: double.
  • borderType: int.

Blurs an image using a Gaussian filter. The function convolves the source image with the specified Gaussian kernel. In-place filtering is supported.

Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • alpha: double.
  • src3: UMat.
  • beta: double.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Performs generalized matrix multiplication. The function cv::gemm performs generalized matrix multiplication similar to the gemm functions in BLAS level 3. For example, gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T) corresponds to \f[\texttt{dst} = \texttt{alpha} \cdot \texttt{src1} ^T \cdot \texttt{src2} + \texttt{beta} \cdot \texttt{src3} ^T\f] In case of complex (two-channel) data, performed a complex matrix multiplication. The function can be replaced with a matrix expression. For example, the above call can be replaced with

Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • alpha: double.
  • src3: UMat.
  • beta: double.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Performs generalized matrix multiplication. The function cv::gemm performs generalized matrix multiplication similar to the gemm functions in BLAS level 3. For example, gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T) corresponds to \f[\texttt{dst} = \texttt{alpha} \cdot \texttt{src1} ^T \cdot \texttt{src2} + \texttt{beta} \cdot \texttt{src3} ^T\f] In case of complex (two-channel) data, performed a complex matrix multiplication. The function can be replaced with a matrix expression. For example, the above call can be replaced with

Has overloading in C++

Returns full configuration time cmake output. Returned value is raw cmake output including version control system revision, compiler version, compiler flags, enabled modules and third party libraries, etc. Output format depends on target architecture.

Returns list of CPU features enabled during compilation. Returned value is a string containing space separated list of CPU features with following markers

Returns the number of CPU ticks. The function returns the current number of CPU ticks on some architectures (such as x86, x64, PowerPC). On other platforms the function is equivalent to getTickCount. It can also be used for very accurate time measurements, as well as for RNG initialization. Note that in case of multi-CPU systems a thread, from which getCPUTickCount is called, can be suspended and resumed at another CPU with its own counter. So, theoretically (and practically) the subsequent calls to the function do not necessary return the monotonously increasing values. Also, since a modern CPU varies the CPU frequency depending on the load, the number of CPU clocks spent in some code cannot be directly converted to time units. Therefore, getTickCount is generally a preferable solution for measuring execution time.

Positional Arguments
  • cameraMatrix: UMat.
Keyword Arguments
  • imgsize: Size.
  • centerPrincipalPoint: bool.

Returns the default new camera matrix. The function returns the camera matrix that is either an exact copy of the input cameraMatrix (when centerPrinicipalPoint=false ), or the modified one (when centerPrincipalPoint=true). In the latter case, the new camera matrix will be: \f[\begin{bmatrix} f_x && 0 && ( \texttt{imgSize.width} -1)*0.5 \\ 0 && f_y && ( \texttt{imgSize.height} -1)*0.5 \\ 0 && 0 && 1 \end{bmatrix} ,\f] where \f$f_x\f$ and \f$f_y\f$ are \f$(0,0)\f$ and \f$(1,1)\f$ elements of cameraMatrix, respectively. By default, the undistortion functions in OpenCV (see #initUndistortRectifyMap, #undistort) do not move the principal point. However, when you work with stereo, it is important to move the principal points in both views to the same y-coordinate (which is required by most of stereo correspondence algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for each view where the principal points are located at the center.

Positional Arguments
  • cameraMatrix: UMat.
Keyword Arguments
  • imgsize: Size.
  • centerPrincipalPoint: bool.

Returns the default new camera matrix. The function returns the camera matrix that is either an exact copy of the input cameraMatrix (when centerPrinicipalPoint=false ), or the modified one (when centerPrincipalPoint=true). In the latter case, the new camera matrix will be: \f[\begin{bmatrix} f_x && 0 && ( \texttt{imgSize.width} -1)*0.5 \\ 0 && f_y && ( \texttt{imgSize.height} -1)*0.5 \\ 0 && 0 && 1 \end{bmatrix} ,\f] where \f$f_x\f$ and \f$f_y\f$ are \f$(0,0)\f$ and \f$(1,1)\f$ elements of cameraMatrix, respectively. By default, the undistortion functions in OpenCV (see #initUndistortRectifyMap, #undistort) do not move the principal point. However, when you work with stereo, it is important to move the principal points in both views to the same y-coordinate (which is required by most of stereo correspondence algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for each view where the principal points are located at the center.

Positional Arguments
  • dx: int.
  • dy: int.
  • ksize: int.
Keyword Arguments
  • kx: UMat.
  • ky: UMat.
  • normalize: bool.
  • ktype: int.

Returns filter coefficients for computing spatial image derivatives. The function computes and returns the filter coefficients for spatial image derivatives. When ksize=FILTER_SCHARR, the Scharr \f$3 \times 3\f$ kernels are generated (see #Scharr). Otherwise, Sobel kernels are generated (see #Sobel). The filters are normally passed to #sepFilter2D or to

Positional Arguments
  • dx: int.
  • dy: int.
  • ksize: int.
Keyword Arguments
  • kx: UMat.
  • ky: UMat.
  • normalize: bool.
  • ktype: int.

Returns filter coefficients for computing spatial image derivatives. The function computes and returns the filter coefficients for spatial image derivatives. When ksize=FILTER_SCHARR, the Scharr \f$3 \times 3\f$ kernels are generated (see #Scharr). Otherwise, Sobel kernels are generated (see #Sobel). The filters are normally passed to #sepFilter2D or to

Positional Arguments
  • fontFace: int.
  • pixelHeight: int.
Keyword Arguments
  • thickness: int.

Calculates the font-specific size to use to achieve a given height in pixels. @return The fontSize to use for cv::putText @see cv::putText

Positional Arguments
  • fontFace: int.
  • pixelHeight: int.
Keyword Arguments
  • thickness: int.

Calculates the font-specific size to use to achieve a given height in pixels. @return The fontSize to use for cv::putText @see cv::putText

Positional Arguments
  • ksize: Size.
  • sigma: double.
  • theta: double.
  • lambd: double.
  • gamma: double.
Keyword Arguments
  • psi: double.
  • ktype: int.

Returns Gabor filter coefficients. For more details about gabor filter equations and parameters, see: Gabor Filter.

Positional Arguments
  • ksize: Size.
  • sigma: double.
  • theta: double.
  • lambd: double.
  • gamma: double.
Keyword Arguments
  • psi: double.
  • ktype: int.

Returns Gabor filter coefficients. For more details about gabor filter equations and parameters, see: Gabor Filter.

Positional Arguments
  • ksize: int.
  • sigma: double.
Keyword Arguments
  • ktype: int.

Returns Gaussian filter coefficients. The function computes and returns the \f$\texttt{ksize} \times 1\f$ matrix of Gaussian filter coefficients: \f[G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},\f] where \f$i=0..\texttt{ksize}-1\f$ and \f$\alpha\f$ is the scale factor chosen so that \f$\sum_i G_i=1\f$. Two of such generated kernels can be passed to sepFilter2D. Those functions automatically recognize smoothing kernels (a symmetrical kernel with sum of weights equal to 1) and handle them accordingly. You may also use the higher-level GaussianBlur.

Positional Arguments
  • ksize: int.
  • sigma: double.
Keyword Arguments
  • ktype: int.

Returns Gaussian filter coefficients. The function computes and returns the \f$\texttt{ksize} \times 1\f$ matrix of Gaussian filter coefficients: \f[G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},\f] where \f$i=0..\texttt{ksize}-1\f$ and \f$\alpha\f$ is the scale factor chosen so that \f$\sum_i G_i=1\f$. Two of such generated kernels can be passed to sepFilter2D. Those functions automatically recognize smoothing kernels (a symmetrical kernel with sum of weights equal to 1) and handle them accordingly. You may also use the higher-level GaussianBlur.

Returns feature name by ID Returns empty string if feature is not defined

Python prototype (for reference):

Returns the number of logical CPUs available for the process.

Returns the number of threads used by OpenCV for parallel regions. Always returns 1 if OpenCV is built without threading support. The exact meaning of return value depends on the threading framework used by OpenCV library

Returns the optimal DFT size for a given vector size. DFT performance is not a monotonic function of a vector size. Therefore, when you calculate convolution of two arrays or perform the spectral analysis of an array, it usually makes sense to pad the input data with zeros to get a bit larger array that can be transformed much faster than the original one. Arrays whose size is a power-of-two (2, 4, 8, 16, 32, ...) are the fastest to process. Though, the arrays whose size is a product of 2's, 3's, and 5's (for example, 300 = 5*5*3*2*2) are also processed quite efficiently. The function cv::getOptimalDFTSize returns the minimum number N that is greater than or equal to vecsize so that the DFT of a vector of size N can be processed efficiently. In the current implementation N = 2 ^p^ * 3 ^q^ * 5 ^r^ for some integer p, q, r. The function returns a negative number if vecsize is too large (very close to INT_MAX ). While the function cannot be used directly to estimate the optimal vector size for DCT transform (since the current DCT implementation supports only even-size vectors), it can be easily processed as getOptimalDFTSize((vecsize+1)/2)*2. @sa dft , dct , idft , idct , mulSpectrums

Positional Arguments
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • imageSize: Size.
  • alpha: double.
Keyword Arguments
  • newImgSize: Size.
  • centerPrincipalPoint: bool.

Returns the new camera intrinsic matrix based on the free scaling parameter.

Positional Arguments
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • imageSize: Size.
  • alpha: double.
Keyword Arguments
  • newImgSize: Size.
  • centerPrincipalPoint: bool.

Returns the new camera intrinsic matrix based on the free scaling parameter.

Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • solveMethod: int.

Calculates a perspective transform from four pairs of the corresponding points. The function calculates the \f$3 \times 3\f$ matrix of a perspective transform so that: \f[\begin{bmatrix} t_i x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f] where \f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\f] @sa findHomography, warpPerspective, perspectiveTransform

Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • solveMethod: int.

Calculates a perspective transform from four pairs of the corresponding points. The function calculates the \f$3 \times 3\f$ matrix of a perspective transform so that: \f[\begin{bmatrix} t_i x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f] where \f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\f] @sa findHomography, warpPerspective, perspectiveTransform

Positional Arguments
  • image: UMat.
  • patchSize: Size.
  • center: Point2f.
Keyword Arguments
  • patch: UMat.
  • patchType: int.

Retrieves a pixel rectangle from an image with sub-pixel accuracy. The function getRectSubPix extracts pixels from src: \f[patch(x, y) = src(x + \texttt{center.x} - ( \texttt{dst.cols} -1)*0.5, y + \texttt{center.y} - ( \texttt{dst.rows} -1)*0.5)\f] where the values of the pixels at non-integer coordinates are retrieved using bilinear interpolation. Every channel of multi-channel images is processed independently. Also the image should be a single channel or three channel image. While the center of the rectangle must be inside the image, parts of the rectangle may be outside.

Positional Arguments
  • image: UMat.
  • patchSize: Size.
  • center: Point2f.
Keyword Arguments
  • patch: UMat.
  • patchType: int.

Retrieves a pixel rectangle from an image with sub-pixel accuracy. The function getRectSubPix extracts pixels from src: \f[patch(x, y) = src(x + \texttt{center.x} - ( \texttt{dst.cols} -1)*0.5, y + \texttt{center.y} - ( \texttt{dst.rows} -1)*0.5)\f] where the values of the pixels at non-integer coordinates are retrieved using bilinear interpolation. Every channel of multi-channel images is processed independently. Also the image should be a single channel or three channel image. While the center of the rectangle must be inside the image, parts of the rectangle may be outside.

Calculates an affine matrix of 2D rotation. The function calculates the following matrix: \f[\begin{bmatrix} \alpha & \beta & (1- \alpha ) \cdot \texttt{center.x} - \beta \cdot \texttt{center.y} \\ - \beta & \alpha & \beta \cdot \texttt{center.x} + (1- \alpha ) \cdot \texttt{center.y} \end{bmatrix}\f] where \f[\begin{array}{l} \alpha = \texttt{scale} \cdot \cos \texttt{angle} , \\ \beta = \texttt{scale} \cdot \sin \texttt{angle} \end{array}\f] The transformation maps the rotation center to itself. If this is not the target, adjust the shift.

Positional Arguments
  • shape: int.
  • ksize: Size.
Keyword Arguments
  • anchor: Point.

Returns a structuring element of the specified size and shape for morphological operations. The function constructs and returns the structuring element that can be further passed to #erode, #dilate or #morphologyEx. But you can also construct an arbitrary binary mask yourself and use it as the structuring element.

Positional Arguments
  • shape: int.
  • ksize: Size.
Keyword Arguments
  • anchor: Point.

Returns a structuring element of the specified size and shape for morphological operations. The function constructs and returns the structuring element that can be further passed to #erode, #dilate or #morphologyEx. But you can also construct an arbitrary binary mask yourself and use it as the structuring element.

Calculates the width and height of a text string. The function cv::getTextSize calculates and returns the size of a box that contains the specified text. That is, the following code renders some text, the tight box surrounding it, and the baseline:

Returns the index of the currently executed thread within the current parallel region. Always returns 0 if called outside of parallel region. @deprecated Current implementation doesn't corresponding to this documentation. The exact meaning of the return value depends on the threading framework used by OpenCV library

Returns the number of ticks. The function returns the number of ticks after the certain event (for example, when the machine was turned on). It can be used to initialize RNG or to measure a function execution time by reading the tick count before and after the function call. @sa getTickFrequency, TickMeter

Returns the number of ticks per second. The function returns the number of ticks per second. That is, the following code computes the execution time in seconds

Returns the trackbar position. The function returns the current position of the specified trackbar. Note: [Qt Backend Only] winname can be empty if the trackbar is attached to the control panel.

Returns major library version

Returns minor library version

Returns revision field of the library version

Returns library version string For example "3.4.1-dev". @sa getMajorVersion, getMinorVersion, getRevisionVersion

Provides rectangle of image in the window. The function getWindowImageRect returns the client screen coordinates, width and height of the image rendering area. @sa resizeWindow moveWindow

Provides parameters of a window. The function getWindowProperty returns properties of a window. @sa setWindowProperty

Positional Arguments
  • image: UMat.
  • maxCorners: int.
  • qualityLevel: double.
  • minDistance: double.
Keyword Arguments
  • corners: UMat.
  • mask: UMat.
  • blockSize: int.
  • useHarrisDetector: bool.
  • k: double.

Determines strong corners on an image. The function finds the most prominent corners in the image or in the specified image region, as described in @cite Shi94

Positional Arguments
  • image: UMat.
  • maxCorners: int.
  • qualityLevel: double.
  • minDistance: double.
Keyword Arguments
  • corners: UMat.
  • mask: UMat.
  • blockSize: int.
  • useHarrisDetector: bool.
  • k: double.

Determines strong corners on an image. The function finds the most prominent corners in the image or in the specified image region, as described in @cite Shi94

Positional Arguments
  • image: UMat
  • maxCorners: int
  • qualityLevel: double
  • minDistance: double
  • mask: UMat
  • blockSize: int
  • gradientSize: int
Keyword Arguments
  • corners: UMat.
  • useHarrisDetector: bool.
  • k: double.

Python prototype (for reference):

Positional Arguments
  • image: UMat
  • maxCorners: int
  • qualityLevel: double
  • minDistance: double
  • mask: UMat
  • blockSize: int
  • gradientSize: int
Keyword Arguments
  • corners: UMat.
  • useHarrisDetector: bool.
  • k: double.

Python prototype (for reference):

Positional Arguments
  • image: UMat.
  • maxCorners: int.
  • qualityLevel: double.
  • minDistance: double.
  • mask: UMat.
Keyword Arguments
  • corners: UMat.
  • cornersQuality: UMat.
  • blockSize: int.
  • gradientSize: int.
  • useHarrisDetector: bool.
  • k: double.

Same as above, but returns also quality measure of the detected corners.

Positional Arguments
  • image: UMat.
  • maxCorners: int.
  • qualityLevel: double.
  • minDistance: double.
  • mask: UMat.
Keyword Arguments
  • corners: UMat.
  • cornersQuality: UMat.
  • blockSize: int.
  • gradientSize: int.
  • useHarrisDetector: bool.
  • k: double.

Same as above, but returns also quality measure of the detected corners.

Positional Arguments
  • img: UMat.
  • mask: UMat.
  • rect: Rect.
  • bgdModel: UMat.
  • fgdModel: UMat.
  • iterCount: int.
Keyword Arguments
  • mode: int.

Runs the GrabCut algorithm. The function implements the GrabCut image segmentation algorithm.

Positional Arguments
  • img: UMat.
  • mask: UMat.
  • rect: Rect.
  • bgdModel: UMat.
  • fgdModel: UMat.
  • iterCount: int.
Keyword Arguments
  • mode: int.

Runs the GrabCut algorithm. The function implements the GrabCut image segmentation algorithm.

Positional Arguments
  • rectList: vector_Rect
  • groupThreshold: int
Keyword Arguments
  • eps: double.

Has overloading in C++

Positional Arguments
  • rectList: vector_Rect
  • groupThreshold: int
Keyword Arguments
  • eps: double.

Has overloading in C++

Returns true if the specified image can be decoded by OpenCV

Returns true if an image with the specified filename can be encoded by OpenCV

Python prototype (for reference):

Positional Arguments
  • src: vector_UMat.
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Positional Arguments
  • src: vector_UMat.
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Positional Arguments
  • image: UMat.
  • method: int.
  • dp: double.
  • minDist: double.
Keyword Arguments
  • circles: UMat.
  • param1: double.
  • param2: double.
  • minRadius: int.
  • maxRadius: int.

Finds circles in a grayscale image using the Hough transform. The function finds circles in a grayscale image using a modification of the Hough transform. Example: : @include snippets/imgproc_HoughLinesCircles.cpp Note: Usually the function detects the centers of circles well. However, it may fail to find correct radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if you know it. Or, in the case of #HOUGH_GRADIENT method you may set maxRadius to a negative number to return centers only without radius search, and find the correct radius using an additional procedure. It also helps to smooth image a bit unless it's already soft. For example, GaussianBlur() with 7x7 kernel and 1.5x1.5 sigma or similar blurring may help.

Positional Arguments
  • image: UMat.
  • method: int.
  • dp: double.
  • minDist: double.
Keyword Arguments
  • circles: UMat.
  • param1: double.
  • param2: double.
  • minRadius: int.
  • maxRadius: int.

Finds circles in a grayscale image using the Hough transform. The function finds circles in a grayscale image using a modification of the Hough transform. Example: : @include snippets/imgproc_HoughLinesCircles.cpp Note: Usually the function detects the centers of circles well. However, it may fail to find correct radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if you know it. Or, in the case of #HOUGH_GRADIENT method you may set maxRadius to a negative number to return centers only without radius search, and find the correct radius using an additional procedure. It also helps to smooth image a bit unless it's already soft. For example, GaussianBlur() with 7x7 kernel and 1.5x1.5 sigma or similar blurring may help.

Positional Arguments
  • image: UMat.
  • rho: double.
  • theta: double.
  • threshold: int.
Keyword Arguments
  • lines: UMat.
  • srn: double.
  • stn: double.
  • min_theta: double.
  • max_theta: double.

Finds lines in a binary image using the standard Hough transform. The function implements the standard or standard multi-scale Hough transform algorithm for line detection. See http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for a good explanation of Hough transform.

Positional Arguments
  • image: UMat.
  • rho: double.
  • theta: double.
  • threshold: int.
Keyword Arguments
  • lines: UMat.
  • srn: double.
  • stn: double.
  • min_theta: double.
  • max_theta: double.

Finds lines in a binary image using the standard Hough transform. The function implements the standard or standard multi-scale Hough transform algorithm for line detection. See http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for a good explanation of Hough transform.

Positional Arguments
  • image: UMat.
  • rho: double.
  • theta: double.
  • threshold: int.
Keyword Arguments
  • lines: UMat.
  • minLineLength: double.
  • maxLineGap: double.

Finds line segments in a binary image using the probabilistic Hough transform. The function implements the probabilistic Hough transform algorithm for line detection, described in @cite Matas00 See the line detection example below: @include snippets/imgproc_HoughLinesP.cpp This is a sample picture the function parameters have been tuned for: image And this is the output of the above program in case of the probabilistic Hough transform: image

Positional Arguments
  • image: UMat.
  • rho: double.
  • theta: double.
  • threshold: int.
Keyword Arguments
  • lines: UMat.
  • minLineLength: double.
  • maxLineGap: double.

Finds line segments in a binary image using the probabilistic Hough transform. The function implements the probabilistic Hough transform algorithm for line detection, described in @cite Matas00 See the line detection example below: @include snippets/imgproc_HoughLinesP.cpp This is a sample picture the function parameters have been tuned for: image And this is the output of the above program in case of the probabilistic Hough transform: image

Positional Arguments
  • point: UMat.
  • lines_max: int.
  • threshold: int.
  • min_rho: double.
  • max_rho: double.
  • rho_step: double.
  • min_theta: double.
  • max_theta: double.
  • theta_step: double.
Keyword Arguments
  • lines: UMat.

Finds lines in a set of points using the standard Hough transform. The function finds lines in a set of points using a modification of the Hough transform. @include snippets/imgproc_HoughLinesPointSet.cpp

Positional Arguments
  • point: UMat.
  • lines_max: int.
  • threshold: int.
  • min_rho: double.
  • max_rho: double.
  • rho_step: double.
  • min_theta: double.
  • max_theta: double.
  • theta_step: double.
Keyword Arguments
  • lines: UMat.

Finds lines in a set of points using the standard Hough transform. The function finds lines in a set of points using a modification of the Hough transform. @include snippets/imgproc_HoughLinesPointSet.cpp

Positional Arguments
  • image: UMat
  • rho: double
  • theta: double
  • threshold: int
Keyword Arguments
  • lines: UMat.
  • srn: double.
  • stn: double.
  • min_theta: double.
  • max_theta: double.

Finds lines in a binary image using the standard Hough transform and get accumulator. Note: This function is for bindings use only. Use original function in C++ code @sa HoughLines

Positional Arguments
  • image: UMat
  • rho: double
  • theta: double
  • threshold: int
Keyword Arguments
  • lines: UMat.
  • srn: double.
  • stn: double.
  • min_theta: double.
  • max_theta: double.

Finds lines in a binary image using the standard Hough transform and get accumulator. Note: This function is for bindings use only. Use original function in C++ code @sa HoughLines

Positional Arguments
  • m: Moments
Keyword Arguments
  • hu: UMat.

Has overloading in C++

Positional Arguments
  • m: Moments
Keyword Arguments
  • hu: UMat.

Has overloading in C++

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Calculates the inverse Discrete Cosine Transform of a 1D or 2D array. idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE). @sa dct, dft, idft, getOptimalDFTSize

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Calculates the inverse Discrete Cosine Transform of a 1D or 2D array. idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE). @sa dct, dft, idft, getOptimalDFTSize

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • nonzeroRows: int.

Calculates the inverse Discrete Fourier Transform of a 1D or 2D array. idft(src, dst, flags) is equivalent to dft(src, dst, flags | #DFT_INVERSE) . Note: None of dft and idft scales the result by default. So, you should pass #DFT_SCALE to one of dft or idft explicitly to make these transforms mutually inverse. @sa dft, dct, idct, mulSpectrums, getOptimalDFTSize

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • nonzeroRows: int.

Calculates the inverse Discrete Fourier Transform of a 1D or 2D array. idft(src, dst, flags) is equivalent to dft(src, dst, flags | #DFT_INVERSE) . Note: None of dft and idft scales the result by default. So, you should pass #DFT_SCALE to one of dft or idft explicitly to make these transforms mutually inverse. @sa dft, dct, idct, mulSpectrums, getOptimalDFTSize

Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.
  • alpha: float.
  • beta: float.

Applying an appropriate non-linear transformation to the gradient field inside the selection and then integrating back with a Poisson solver, modifies locally the apparent illumination of an image. This is useful to highlight under-exposed foreground objects or to reduce specular reflections.

Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.
  • alpha: float.
  • beta: float.

Applying an appropriate non-linear transformation to the gradient field inside the selection and then integrating back with a Poisson solver, modifies locally the apparent illumination of an image. This is useful to highlight under-exposed foreground objects or to reduce specular reflections.

Positional Arguments
  • filename: String.
Keyword Arguments
  • flags: int.

Returns the number of images inside the give file The function imcount will return the number of pages in a multi-page image, or 1 for single-page images

Positional Arguments
  • filename: String.
Keyword Arguments
  • flags: int.

Returns the number of images inside the give file The function imcount will return the number of pages in a multi-page image, or 1 for single-page images

Positional Arguments
  • ext: String.
  • img: UMat.
Keyword Arguments
  • params: vector_int.

Encodes an image into a memory buffer. The function imencode compresses the image and stores it in the memory buffer that is resized to fit the result. See cv::imwrite for the list of supported formats and flags description.

Positional Arguments
  • ext: String.
  • img: UMat.
Keyword Arguments
  • params: vector_int.

Encodes an image into a memory buffer. The function imencode compresses the image and stores it in the memory buffer that is resized to fit the result. See cv::imwrite for the list of supported formats and flags description.

Positional Arguments
  • filename: String.
Keyword Arguments
  • flags: int.

Loads an image from a file. @anchor imread The function imread loads an image from the specified file and returns it. If the image cannot be read (because of missing file, improper permissions, unsupported or invalid format), the function returns an empty matrix ( Mat::data==NULL ). Currently, the following file formats are supported

Positional Arguments
  • filename: String.
Keyword Arguments
  • flags: int.

Loads an image from a file. @anchor imread The function imread loads an image from the specified file and returns it. If the image cannot be read (because of missing file, improper permissions, unsupported or invalid format), the function returns an empty matrix ( Mat::data==NULL ). Currently, the following file formats are supported

Positional Arguments
  • filename: String.
Keyword Arguments
  • mats: vector_Mat.
  • flags: int.

Loads a multi-page image from a file. The function imreadmulti loads a multi-page image from the specified file into a vector of Mat objects. @sa cv::imread

Positional Arguments
  • filename: String.
Keyword Arguments
  • mats: vector_Mat.
  • flags: int.

Loads a multi-page image from a file. The function imreadmulti loads a multi-page image from the specified file into a vector of Mat objects. @sa cv::imread

Positional Arguments
  • filename: String.
  • start: int.
  • count: int.
Keyword Arguments
  • mats: vector_Mat.
  • flags: int.

Loads a of images of a multi-page image from a file. The function imreadmulti loads a specified range from a multi-page image from the specified file into a vector of Mat objects. @sa cv::imread

Positional Arguments
  • filename: String.
  • start: int.
  • count: int.
Keyword Arguments
  • mats: vector_Mat.
  • flags: int.

Loads a of images of a multi-page image from a file. The function imreadmulti loads a specified range from a multi-page image from the specified file into a vector of Mat objects. @sa cv::imread

Positional Arguments
  • filename: String.
  • img: UMat.
Keyword Arguments
  • params: vector_int.

Saves an image to a specified file. The function imwrite saves the image to the specified file. The image format is chosen based on the filename extension (see cv::imread for the list of extensions). In general, only 8-bit single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function, with these exceptions

Positional Arguments
  • filename: String.
  • img: UMat.
Keyword Arguments
  • params: vector_int.

Saves an image to a specified file. The function imwrite saves the image to the specified file. The image format is chosen based on the filename extension (see cv::imread for the list of extensions). In general, only 8-bit single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function, with these exceptions

Positional Arguments
  • filename: String
  • img: vector_UMat
Keyword Arguments
  • params: vector_int.

Python prototype (for reference):

Positional Arguments
  • filename: String
  • img: vector_UMat
Keyword Arguments
  • params: vector_int.

Python prototype (for reference):

Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints: vector_UMat.
  • imageSize: Size.
Keyword Arguments
  • aspectRatio: double.

Finds an initial camera intrinsic matrix from 3D-2D point correspondences.

Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints: vector_UMat.
  • imageSize: Size.
Keyword Arguments
  • aspectRatio: double.

Finds an initial camera intrinsic matrix from 3D-2D point correspondences.

Positional Arguments
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • r: UMat.
  • newCameraMatrix: UMat.
  • size: Size.
  • m1type: int.
Keyword Arguments
  • map1: UMat.
  • map2: UMat.

Computes the projection and inverse-rectification transformation map. In essense, this is the inverse of #initUndistortRectifyMap to accomodate stereo-rectification of projectors ('inverse-cameras') in projector-camera pairs. The function computes the joint projection and inverse rectification transformation and represents the result in the form of maps for #remap. The projected image looks like a distorted version of the original which, once projected by a projector, should visually match the original. In case of a monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by #getOptimalNewCameraMatrix for a better control over scaling. In case of a projector-camera pair, newCameraMatrix is normally set to P1 or P2 computed by #stereoRectify . The projector is oriented differently in the coordinate space, according to R. In case of projector-camera pairs, this helps align the projector (in the same manner as #initUndistortRectifyMap for the camera) to create a stereo-rectified pair. This allows epipolar lines on both images to become horizontal and have the same y-coordinate (in case of a horizontally aligned projector-camera pair). The function builds the maps for the inverse mapping algorithm that is used by #remap. That is, for each pixel \f$(u, v)\f$ in the destination (projected and inverse-rectified) image, the function computes the corresponding coordinates in the source image (that is, in the original digital image). The following process is applied: \f[ \begin{array}{l} \text{newCameraMatrix}\\ x \leftarrow (u - {c'}_x)/{f'}_x \\ y \leftarrow (v - {c'}_y)/{f'}_y \\ \\\text{Undistortion} \\\scriptsize{\textit{though equation shown is for radial undistortion, function implements cv::undistortPoints()}}\\ r^2 \leftarrow x^2 + y^2 \\ \theta \leftarrow \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6}\\ x' \leftarrow \frac{x}{\theta} \\ y' \leftarrow \frac{y}{\theta} \\ \\\text{Rectification}\\ {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\ x'' \leftarrow X/W \\ y'' \leftarrow Y/W \\ \\\text{cameraMatrix}\\ map_x(u,v) \leftarrow x'' f_x + c_x \\ map_y(u,v) \leftarrow y'' f_y + c_y \end{array} \f] where \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ are the distortion coefficients vector distCoeffs. In case of a stereo-rectified projector-camera pair, this function is called for the projector while #initUndistortRectifyMap is called for the camera head. This is done after #stereoRectify, which in turn is called after #stereoCalibrate. If the projector-camera pair is not calibrated, it is still possible to compute the rectification transformations directly from the fundamental matrix using #stereoRectifyUncalibrated. For the projector and camera, the function computes homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D space. R can be computed from H as \f[\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}\f] where cameraMatrix can be chosen arbitrarily.

Positional Arguments
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • r: UMat.
  • newCameraMatrix: UMat.
  • size: Size.
  • m1type: int.
Keyword Arguments
  • map1: UMat.
  • map2: UMat.

Computes the projection and inverse-rectification transformation map. In essense, this is the inverse of #initUndistortRectifyMap to accomodate stereo-rectification of projectors ('inverse-cameras') in projector-camera pairs. The function computes the joint projection and inverse rectification transformation and represents the result in the form of maps for #remap. The projected image looks like a distorted version of the original which, once projected by a projector, should visually match the original. In case of a monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by #getOptimalNewCameraMatrix for a better control over scaling. In case of a projector-camera pair, newCameraMatrix is normally set to P1 or P2 computed by #stereoRectify . The projector is oriented differently in the coordinate space, according to R. In case of projector-camera pairs, this helps align the projector (in the same manner as #initUndistortRectifyMap for the camera) to create a stereo-rectified pair. This allows epipolar lines on both images to become horizontal and have the same y-coordinate (in case of a horizontally aligned projector-camera pair). The function builds the maps for the inverse mapping algorithm that is used by #remap. That is, for each pixel \f$(u, v)\f$ in the destination (projected and inverse-rectified) image, the function computes the corresponding coordinates in the source image (that is, in the original digital image). The following process is applied: \f[ \begin{array}{l} \text{newCameraMatrix}\\ x \leftarrow (u - {c'}_x)/{f'}_x \\ y \leftarrow (v - {c'}_y)/{f'}_y \\ \\\text{Undistortion} \\\scriptsize{\textit{though equation shown is for radial undistortion, function implements cv::undistortPoints()}}\\ r^2 \leftarrow x^2 + y^2 \\ \theta \leftarrow \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6}\\ x' \leftarrow \frac{x}{\theta} \\ y' \leftarrow \frac{y}{\theta} \\ \\\text{Rectification}\\ {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\ x'' \leftarrow X/W \\ y'' \leftarrow Y/W \\ \\\text{cameraMatrix}\\ map_x(u,v) \leftarrow x'' f_x + c_x \\ map_y(u,v) \leftarrow y'' f_y + c_y \end{array} \f] where \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ are the distortion coefficients vector distCoeffs. In case of a stereo-rectified projector-camera pair, this function is called for the projector while #initUndistortRectifyMap is called for the camera head. This is done after #stereoRectify, which in turn is called after #stereoCalibrate. If the projector-camera pair is not calibrated, it is still possible to compute the rectification transformations directly from the fundamental matrix using #stereoRectifyUncalibrated. For the projector and camera, the function computes homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D space. R can be computed from H as \f[\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}\f] where cameraMatrix can be chosen arbitrarily.

Positional Arguments
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • r: UMat.
  • newCameraMatrix: UMat.
  • size: Size.
  • m1type: int.
Keyword Arguments
  • map1: UMat.
  • map2: UMat.

Computes the undistortion and rectification transformation map. The function computes the joint undistortion and rectification transformation and represents the result in the form of maps for #remap. The undistorted image looks like original, as if it is captured with a camera using the camera matrix =newCameraMatrix and zero distortion. In case of a monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by #getOptimalNewCameraMatrix for a better control over scaling. In case of a stereo camera, newCameraMatrix is normally set to P1 or P2 computed by #stereoRectify . Also, this new camera is oriented differently in the coordinate space, according to R. That, for example, helps to align two heads of a stereo camera so that the epipolar lines on both images become horizontal and have the same y- coordinate (in case of a horizontally aligned stereo camera). The function actually builds the maps for the inverse mapping algorithm that is used by #remap. That is, for each pixel \f$(u, v)\f$ in the destination (corrected and rectified) image, the function computes the corresponding coordinates in the source image (that is, in the original image from camera). The following process is applied: \f[ \begin{array}{l} x \leftarrow (u - {c'}_x)/{f'}_x \\ y \leftarrow (v - {c'}_y)/{f'}_y \\ {[X\,Y\,W]} ^T \leftarrow R^{-1}*[x \, y \, 1]^T \\ x' \leftarrow X/W \\ y' \leftarrow Y/W \\ r^2 \leftarrow x'^2 + y'^2 \\ x'' \leftarrow x' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + 2p_1 x' y' + p_2(r^2 + 2 x'^2) + s_1 r^2 + s_2 r^4\\ y'' \leftarrow y' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' + s_3 r^2 + s_4 r^4 \\ s\vecthree{x'''}{y'''}{1} = \vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}((\tau_x, \tau_y)} {0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)} {0}{0}{1} R(\tau_x, \tau_y) \vecthree{x''}{y''}{1}\\ map_x(u,v) \leftarrow x''' f_x + c_x \\ map_y(u,v) \leftarrow y''' f_y + c_y \end{array} \f] where \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ are the distortion coefficients. In case of a stereo camera, this function is called twice: once for each camera head, after #stereoRectify, which in its turn is called after #stereoCalibrate. But if the stereo camera was not calibrated, it is still possible to compute the rectification transformations directly from the fundamental matrix using #stereoRectifyUncalibrated. For each camera, the function computes homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D space. R can be computed from H as \f[\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}\f] where cameraMatrix can be chosen arbitrarily.

Positional Arguments
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • r: UMat.
  • newCameraMatrix: UMat.
  • size: Size.
  • m1type: int.
Keyword Arguments
  • map1: UMat.
  • map2: UMat.

Computes the undistortion and rectification transformation map. The function computes the joint undistortion and rectification transformation and represents the result in the form of maps for #remap. The undistorted image looks like original, as if it is captured with a camera using the camera matrix =newCameraMatrix and zero distortion. In case of a monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by #getOptimalNewCameraMatrix for a better control over scaling. In case of a stereo camera, newCameraMatrix is normally set to P1 or P2 computed by #stereoRectify . Also, this new camera is oriented differently in the coordinate space, according to R. That, for example, helps to align two heads of a stereo camera so that the epipolar lines on both images become horizontal and have the same y- coordinate (in case of a horizontally aligned stereo camera). The function actually builds the maps for the inverse mapping algorithm that is used by #remap. That is, for each pixel \f$(u, v)\f$ in the destination (corrected and rectified) image, the function computes the corresponding coordinates in the source image (that is, in the original image from camera). The following process is applied: \f[ \begin{array}{l} x \leftarrow (u - {c'}_x)/{f'}_x \\ y \leftarrow (v - {c'}_y)/{f'}_y \\ {[X\,Y\,W]} ^T \leftarrow R^{-1}*[x \, y \, 1]^T \\ x' \leftarrow X/W \\ y' \leftarrow Y/W \\ r^2 \leftarrow x'^2 + y'^2 \\ x'' \leftarrow x' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + 2p_1 x' y' + p_2(r^2 + 2 x'^2) + s_1 r^2 + s_2 r^4\\ y'' \leftarrow y' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' + s_3 r^2 + s_4 r^4 \\ s\vecthree{x'''}{y'''}{1} = \vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}((\tau_x, \tau_y)} {0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)} {0}{0}{1} R(\tau_x, \tau_y) \vecthree{x''}{y''}{1}\\ map_x(u,v) \leftarrow x''' f_x + c_x \\ map_y(u,v) \leftarrow y''' f_y + c_y \end{array} \f] where \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ are the distortion coefficients. In case of a stereo camera, this function is called twice: once for each camera head, after #stereoRectify, which in its turn is called after #stereoCalibrate. But if the stereo camera was not calibrated, it is still possible to compute the rectification transformations directly from the fundamental matrix using #stereoRectifyUncalibrated. For each camera, the function computes homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D space. R can be computed from H as \f[\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}\f] where cameraMatrix can be chosen arbitrarily.

Positional Arguments
  • src: UMat.
  • inpaintMask: UMat.
  • inpaintRadius: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Restores the selected region in an image using the region neighborhood.

Positional Arguments
  • src: UMat.
  • inpaintMask: UMat.
  • inpaintRadius: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Restores the selected region in an image using the region neighborhood.

Positional Arguments
  • src: UMat.
  • lowerb: UMat.
  • upperb: UMat.
Keyword Arguments
  • dst: UMat.

Checks if array elements lie between the elements of two other arrays. The function checks the range as follows

Positional Arguments
  • src: UMat.
  • lowerb: UMat.
  • upperb: UMat.
Keyword Arguments
  • dst: UMat.

Checks if array elements lie between the elements of two other arrays. The function checks the range as follows

Inserts a single channel to dst (coi is 0-based index) @sa mixChannels, merge

Positional Arguments
  • src: UMat
Keyword Arguments
  • sum: UMat.
  • sqsum: UMat.
  • sdepth: int.
  • sqdepth: int.

Has overloading in C++

Positional Arguments
  • src: UMat
Keyword Arguments
  • sum: UMat.
  • sqsum: UMat.
  • sdepth: int.
  • sqdepth: int.

Has overloading in C++

Positional Arguments
  • src: UMat.
Keyword Arguments
  • sum: UMat.
  • sqsum: UMat.
  • tilted: UMat.
  • sdepth: int.
  • sqdepth: int.

Calculates the integral of an image. The function calculates one or more integral images for the source image as follows: \f[\texttt{sum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)\f] \f[\texttt{sqsum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)^2\f] \f[\texttt{tilted} (X,Y) = \sum _{y<Y,abs(x-X+1) \leq Y-y-1} \texttt{image} (x,y)\f] Using these integral images, you can calculate sum, mean, and standard deviation over a specific up-right or rotated rectangular region of the image in a constant time, for example: \f[\sum _{x_1 \leq x < x_2, \, y_1 \leq y < y_2} \texttt{image} (x,y) = \texttt{sum} (x_2,y_2)- \texttt{sum} (x_1,y_2)- \texttt{sum} (x_2,y_1)+ \texttt{sum} (x_1,y_1)\f] It makes possible to do a fast blurring or fast block correlation with a variable window size, for example. In case of multi-channel images, sums for each channel are accumulated independently. As a practical example, the next figure shows the calculation of the integral of a straight rectangle Rect(3,3,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the original image are shown, as well as the relative pixels in the integral images sum and tilted . integral calculation example

Positional Arguments
  • src: UMat.
Keyword Arguments
  • sum: UMat.
  • sqsum: UMat.
  • tilted: UMat.
  • sdepth: int.
  • sqdepth: int.

Calculates the integral of an image. The function calculates one or more integral images for the source image as follows: \f[\texttt{sum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)\f] \f[\texttt{sqsum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)^2\f] \f[\texttt{tilted} (X,Y) = \sum _{y<Y,abs(x-X+1) \leq Y-y-1} \texttt{image} (x,y)\f] Using these integral images, you can calculate sum, mean, and standard deviation over a specific up-right or rotated rectangular region of the image in a constant time, for example: \f[\sum _{x_1 \leq x < x_2, \, y_1 \leq y < y_2} \texttt{image} (x,y) = \texttt{sum} (x_2,y_2)- \texttt{sum} (x_1,y_2)- \texttt{sum} (x_2,y_1)+ \texttt{sum} (x_1,y_1)\f] It makes possible to do a fast blurring or fast block correlation with a variable window size, for example. In case of multi-channel images, sums for each channel are accumulated independently. As a practical example, the next figure shows the calculation of the integral of a straight rectangle Rect(3,3,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the original image are shown, as well as the relative pixels in the integral images sum and tilted . integral calculation example

Positional Arguments
  • src: UMat
Keyword Arguments
  • sum: UMat.
  • sdepth: int.

Has overloading in C++

Positional Arguments
  • src: UMat
Keyword Arguments
  • sum: UMat.
  • sdepth: int.

Has overloading in C++

Positional Arguments
  • p1: UMat.
  • p2: UMat.
Keyword Arguments
  • p12: UMat.
  • handleNested: bool.

Finds intersection of two convex polygons

Positional Arguments
  • p1: UMat.
  • p2: UMat.
Keyword Arguments
  • p12: UMat.
  • handleNested: bool.

Finds intersection of two convex polygons

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Finds the inverse or pseudo-inverse of a matrix. The function cv::invert inverts the matrix src and stores the result in dst . When the matrix src is singular or non-square, the function calculates the pseudo-inverse matrix (the dst matrix) so that norm(src*dst - I) is minimal, where I is an identity matrix. In case of the #DECOMP_LU method, the function returns non-zero value if the inverse has been successfully calculated and 0 if src is singular. In case of the #DECOMP_SVD method, the function returns the inverse condition number of src (the ratio of the smallest singular value to the largest singular value) and 0 if src is singular. The SVD method calculates a pseudo-inverse matrix if src is singular. Similarly to #DECOMP_LU, the method #DECOMP_CHOLESKY works only with non-singular square matrices that should also be symmetrical and positively defined. In this case, the function stores the inverted matrix in dst and returns non-zero. Otherwise, it returns 0. @sa solve, SVD

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Finds the inverse or pseudo-inverse of a matrix. The function cv::invert inverts the matrix src and stores the result in dst . When the matrix src is singular or non-square, the function calculates the pseudo-inverse matrix (the dst matrix) so that norm(src*dst - I) is minimal, where I is an identity matrix. In case of the #DECOMP_LU method, the function returns non-zero value if the inverse has been successfully calculated and 0 if src is singular. In case of the #DECOMP_SVD method, the function returns the inverse condition number of src (the ratio of the smallest singular value to the largest singular value) and 0 if src is singular. The SVD method calculates a pseudo-inverse matrix if src is singular. Similarly to #DECOMP_LU, the method #DECOMP_CHOLESKY works only with non-singular square matrices that should also be symmetrical and positively defined. In this case, the function stores the inverted matrix in dst and returns non-zero. Otherwise, it returns 0. @sa solve, SVD

Positional Arguments
  • m: UMat.
Keyword Arguments
  • iM: UMat.

Inverts an affine transformation. The function computes an inverse affine transformation represented by \f$2 \times 3\f$ matrix M: \f[\begin{bmatrix} a_{11} & a_{12} & b_1 \\ a_{21} & a_{22} & b_2 \end{bmatrix}\f] The result is also a \f$2 \times 3\f$ matrix of the same type as M.

Positional Arguments
  • m: UMat.
Keyword Arguments
  • iM: UMat.

Inverts an affine transformation. The function computes an inverse affine transformation represented by \f$2 \times 3\f$ matrix M: \f[\begin{bmatrix} a_{11} & a_{12} & b_1 \\ a_{21} & a_{22} & b_2 \end{bmatrix}\f] The result is also a \f$2 \times 3\f$ matrix of the same type as M.

Tests a contour convexity. The function tests whether the input contour is convex or not. The contour must be simple, that is, without self-intersections. Otherwise, the function output is undefined.

Positional Arguments
  • data: UMat.
  • k: int.
  • bestLabels: UMat.
  • criteria: TermCriteria.
  • attempts: int.
  • flags: int.
Keyword Arguments
  • centers: UMat.

Finds centers of clusters and groups input samples around the clusters. The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters and groups the input samples around the clusters. As an output, \f$\texttt{bestLabels}_i\f$ contains a 0-based cluster index for the sample stored in the \f$i^{th}\f$ row of the samples matrix. Note:

Positional Arguments
  • data: UMat.
  • k: int.
  • bestLabels: UMat.
  • criteria: TermCriteria.
  • attempts: int.
  • flags: int.
Keyword Arguments
  • centers: UMat.

Finds centers of clusters and groups input samples around the clusters. The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters and groups the input samples around the clusters. As an output, \f$\texttt{bestLabels}_i\f$ contains a 0-based cluster index for the sample stored in the \f$i^{th}\f$ row of the samples matrix. Note:

Positional Arguments
  • src: UMat.
  • ddepth: int.
Keyword Arguments
  • dst: UMat.
  • ksize: int.
  • scale: double.
  • delta: double.
  • borderType: int.

Calculates the Laplacian of an image. The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator: \f[\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\f] This is done when ksize > 1. When ksize == 1, the Laplacian is computed by filtering the image with the following \f$3 \times 3\f$ aperture: \f[\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\f]

Positional Arguments
  • src: UMat.
  • ddepth: int.
Keyword Arguments
  • dst: UMat.
  • ksize: int.
  • scale: double.
  • delta: double.
  • borderType: int.

Calculates the Laplacian of an image. The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator: \f[\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\f] This is done when ksize > 1. When ksize == 1, the Laplacian is computed by filtering the image with the following \f$3 \times 3\f$ aperture: \f[\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\f]

Positional Arguments
  • img: UMat. Image.
  • pt1: Point.
  • pt2: Point.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a line segment connecting two points. The function line draws the line segment between pt1 and pt2 points in the image. The line is clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased lines are drawn using Gaussian filtering.

Positional Arguments
  • img: UMat. Image.
  • pt1: Point.
  • pt2: Point.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a line segment connecting two points. The function line draws the line segment between pt1 and pt2 points in the image. The line is clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased lines are drawn using Gaussian filtering.

Positional Arguments
  • src: UMat.
  • center: Point2f.
  • maxRadius: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Remaps an image to polar coordinates space. @deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags) @internal Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image c)"): \f[\begin{array}{l} dst( \rho , \phi ) = src(x,y) \\ dst.size() \leftarrow src.size() \end{array}\f] where \f[\begin{array}{l} I = (dx,dy) = (x - center.x,y - center.y) \\ \rho = Kmag \cdot \texttt{magnitude} (I) ,\\ \phi = angle \cdot \texttt{angle} (I) \end{array}\f] and \f[\begin{array}{l} Kx = src.cols / maxRadius \\ Ky = src.rows / 2\Pi \end{array}\f] Note:

Positional Arguments
  • src: UMat.
  • center: Point2f.
  • maxRadius: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Remaps an image to polar coordinates space. @deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags) @internal Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image c)"): \f[\begin{array}{l} dst( \rho , \phi ) = src(x,y) \\ dst.size() \leftarrow src.size() \end{array}\f] where \f[\begin{array}{l} I = (dx,dy) = (x - center.x,y - center.y) \\ \rho = Kmag \cdot \texttt{magnitude} (I) ,\\ \phi = angle \cdot \texttt{angle} (I) \end{array}\f] and \f[\begin{array}{l} Kx = src.cols / maxRadius \\ Ky = src.rows / 2\Pi \end{array}\f] Note:

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the natural logarithm of every array element. The function cv::log calculates the natural logarithm of every element of the input array: \f[\texttt{dst} (I) = \log (\texttt{src}(I)) \f] Output on zero, negative and special (NaN, Inf) values is undefined. @sa exp, cartToPolar, polarToCart, phase, pow, sqrt, magnitude

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the natural logarithm of every array element. The function cv::log calculates the natural logarithm of every element of the input array: \f[\texttt{dst} (I) = \log (\texttt{src}(I)) \f] Output on zero, negative and special (NaN, Inf) values is undefined. @sa exp, cartToPolar, polarToCart, phase, pow, sqrt, magnitude

Positional Arguments
  • src: UMat.
  • center: Point2f.
  • m: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Remaps an image to semilog-polar coordinates space. @deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags+WARP_POLAR_LOG); @internal Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image d)"): \f[\begin{array}{l} dst( \rho , \phi ) = src(x,y) \\ dst.size() \leftarrow src.size() \end{array}\f] where \f[\begin{array}{l} I = (dx,dy) = (x - center.x,y - center.y) \\ \rho = M \cdot log_e(\texttt{magnitude} (I)) ,\\ \phi = Kangle \cdot \texttt{angle} (I) \\ \end{array}\f] and \f[\begin{array}{l} M = src.cols / log_e(maxRadius) \\ Kangle = src.rows / 2\Pi \\ \end{array}\f] The function emulates the human "foveal" vision and can be used for fast scale and rotation-invariant template matching, for object tracking and so forth. Note:

Positional Arguments
  • src: UMat.
  • center: Point2f.
  • m: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Remaps an image to semilog-polar coordinates space. @deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags+WARP_POLAR_LOG); @internal Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image d)"): \f[\begin{array}{l} dst( \rho , \phi ) = src(x,y) \\ dst.size() \leftarrow src.size() \end{array}\f] where \f[\begin{array}{l} I = (dx,dy) = (x - center.x,y - center.y) \\ \rho = M \cdot log_e(\texttt{magnitude} (I)) ,\\ \phi = Kangle \cdot \texttt{angle} (I) \\ \end{array}\f] and \f[\begin{array}{l} M = src.cols / log_e(maxRadius) \\ Kangle = src.rows / 2\Pi \\ \end{array}\f] The function emulates the human "foveal" vision and can be used for fast scale and rotation-invariant template matching, for object tracking and so forth. Note:

Positional Arguments
  • src: UMat.
  • lut: UMat.
Keyword Arguments
  • dst: UMat.

Performs a look-up table transform of an array. The function LUT fills the output array with values from the look-up table. Indices of the entries are taken from the input array. That is, the function processes each element of src as follows: \f[\texttt{dst} (I) \leftarrow \texttt{lut(src(I) + d)}\f] where \f[d = \fork{0}{if (\texttt{src}) has depth (\texttt{CV_8U})}{128}{if (\texttt{src}) has depth (\texttt{CV_8S})}\f]

Positional Arguments
  • src: UMat.
  • lut: UMat.
Keyword Arguments
  • dst: UMat.

Performs a look-up table transform of an array. The function LUT fills the output array with values from the look-up table. Indices of the entries are taken from the input array. That is, the function processes each element of src as follows: \f[\texttt{dst} (I) \leftarrow \texttt{lut(src(I) + d)}\f] where \f[d = \fork{0}{if (\texttt{src}) has depth (\texttt{CV_8U})}{128}{if (\texttt{src}) has depth (\texttt{CV_8S})}\f]

Positional Arguments
  • x: UMat.
  • y: UMat.
Keyword Arguments
  • magnitude: UMat.

Calculates the magnitude of 2D vectors. The function cv::magnitude calculates the magnitude of 2D vectors formed from the corresponding elements of x and y arrays: \f[\texttt{dst} (I) = \sqrt{\texttt{x}(I)^2 + \texttt{y}(I)^2}\f]

Positional Arguments
  • x: UMat.
  • y: UMat.
Keyword Arguments
  • magnitude: UMat.

Calculates the magnitude of 2D vectors. The function cv::magnitude calculates the magnitude of 2D vectors formed from the corresponding elements of x and y arrays: \f[\texttt{dst} (I) = \sqrt{\texttt{x}(I)^2 + \texttt{y}(I)^2}\f]

Calculates the Mahalanobis distance between two vectors. The function cv::Mahalanobis calculates and returns the weighted distance between two vectors: \f[d( \texttt{vec1} , \texttt{vec2} )= \sqrt{\sum_{i,j}{\texttt{icovar(i,j)}\cdot(\texttt{vec1}(I)-\texttt{vec2}(I))\cdot(\texttt{vec1(j)}-\texttt{vec2(j)})} }\f] The covariance matrix may be calculated using the #calcCovarMatrix function and then inverted using the invert function (preferably using the #DECOMP_SVD method, as the most accurate).

Compares two shapes. The function compares two shapes. All three implemented methods use the Hu invariants (see #HuMoments)

Positional Arguments
  • image: UMat.
  • templ: UMat.
  • method: int.
Keyword Arguments
  • result: UMat.
  • mask: UMat.

Compares a template against overlapped image regions. The function slides through image , compares the overlapped patches of size \f$w \times h\f$ against templ using the specified method and stores the comparison results in result . #TemplateMatchModes describes the formulae for the available comparison methods ( \f$I\f$ denotes image, \f$T\f$ template, \f$R\f$ result, \f$M\f$ the optional mask ). The summation is done over template and/or the image patch: \f$x' = 0...w-1, y' = 0...h-1\f$ After the function finishes the comparison, the best matches can be found as global minimums (when #TM_SQDIFF was used) or maximums (when #TM_CCORR or #TM_CCOEFF was used) using the #minMaxLoc function. In case of a color image, template summation in the numerator and each sum in the denominator is done over all of the channels and separate mean values are used for each channel. That is, the function can take a color template and a color image. The result will still be a single-channel image, which is easier to analyze.

Positional Arguments
  • image: UMat.
  • templ: UMat.
  • method: int.
Keyword Arguments
  • result: UMat.
  • mask: UMat.

Compares a template against overlapped image regions. The function slides through image , compares the overlapped patches of size \f$w \times h\f$ against templ using the specified method and stores the comparison results in result . #TemplateMatchModes describes the formulae for the available comparison methods ( \f$I\f$ denotes image, \f$T\f$ template, \f$R\f$ result, \f$M\f$ the optional mask ). The summation is done over template and/or the image patch: \f$x' = 0...w-1, y' = 0...h-1\f$ After the function finishes the comparison, the best matches can be found as global minimums (when #TM_SQDIFF was used) or maximums (when #TM_CCORR or #TM_CCOEFF was used) using the #minMaxLoc function. In case of a color image, template summation in the numerator and each sum in the denominator is done over all of the channels and separate mean values are used for each channel. That is, the function can take a color template and a color image. The result will still be a single-channel image, which is easier to analyze.

Positional Arguments
  • a: UMat.
  • b: UMat.
Keyword Arguments
  • dABdA: UMat.
  • dABdB: UMat.

Computes partial derivatives of the matrix product for each multiplied matrix.

Positional Arguments
  • a: UMat.
  • b: UMat.
Keyword Arguments
  • dABdA: UMat.
  • dABdB: UMat.

Computes partial derivatives of the matrix product for each multiplied matrix.

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates per-element maximum of two arrays or an array and a scalar. The function cv::max calculates the per-element maximum of two arrays: \f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{src2} (I))\f] or array and a scalar: \f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{value} )\f] @sa min, compare, inRange, minMaxLoc, @ref MatrixExpressions

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates per-element maximum of two arrays or an array and a scalar. The function cv::max calculates the per-element maximum of two arrays: \f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{src2} (I))\f] or array and a scalar: \f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{value} )\f] @sa min, compare, inRange, minMaxLoc, @ref MatrixExpressions

Positional Arguments
  • src: UMat.
Keyword Arguments
  • mask: UMat.

Calculates an average (mean) of array elements. The function cv::mean calculates the mean value M of array elements, independently for each channel, and return it: \f[\begin{array}{l} N = \sum _{I: \; \texttt{mask} (I) \ne 0} 1 \\ M_c = \left ( \sum _{I: \; \texttt{mask} (I) \ne 0}{ \texttt{mtx} (I)_c} \right )/N \end{array}\f] When all the mask elements are 0's, the function returns Scalar::all(0)

Positional Arguments
  • src: UMat.
Keyword Arguments
  • mask: UMat.

Calculates an average (mean) of array elements. The function cv::mean calculates the mean value M of array elements, independently for each channel, and return it: \f[\begin{array}{l} N = \sum _{I: \; \texttt{mask} (I) \ne 0} 1 \\ M_c = \left ( \sum _{I: \; \texttt{mask} (I) \ne 0}{ \texttt{mtx} (I)_c} \right )/N \end{array}\f] When all the mask elements are 0's, the function returns Scalar::all(0)

Finds an object on a back projection image.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • mean: UMat.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • mean: UMat.

Positional Arguments
  • src: UMat.
  • ksize: int.
Keyword Arguments
  • dst: UMat.

Blurs an image using the median filter. The function smoothes an image using the median filter with the \f$\texttt{ksize} \times \texttt{ksize}\f$ aperture. Each channel of a multi-channel image is processed independently. In-place operation is supported. Note: The median filter uses #BORDER_REPLICATE internally to cope with border pixels, see #BorderTypes

Positional Arguments
  • src: UMat.
  • ksize: int.
Keyword Arguments
  • dst: UMat.

Blurs an image using the median filter. The function smoothes an image using the median filter with the \f$\texttt{ksize} \times \texttt{ksize}\f$ aperture. Each channel of a multi-channel image is processed independently. In-place operation is supported. Note: The median filter uses #BORDER_REPLICATE internally to cope with border pixels, see #BorderTypes

Positional Arguments
  • mv: vector_UMat.
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Positional Arguments
  • mv: vector_UMat.
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates per-element minimum of two arrays or an array and a scalar. The function cv::min calculates the per-element minimum of two arrays: \f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{src2} (I))\f] or array and a scalar: \f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{value} )\f] @sa max, compare, inRange, minMaxLoc

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates per-element minimum of two arrays or an array and a scalar. The function cv::min calculates the per-element minimum of two arrays: \f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{src2} (I))\f] or array and a scalar: \f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{value} )\f] @sa max, compare, inRange, minMaxLoc

Finds a rotated rectangle of the minimum area enclosing the input 2D point set. The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a specified point set. Developer should keep in mind that the returned RotatedRect can contain negative indices when data is close to the containing Mat element boundary.

Finds a circle of the minimum area enclosing a 2D point set. The function finds the minimal enclosing circle of a 2D point set using an iterative algorithm.

Positional Arguments
  • points: UMat.
Keyword Arguments
  • triangle: UMat.

Finds a triangle of minimum area enclosing a 2D point set and returns its area. The function finds a triangle of minimum area enclosing the given set of 2D points and returns its area. The output for a given 2D point set is shown in the image below. 2D points are depicted in red and the enclosing triangle in yellow*. Sample output of the minimum enclosing triangle function The implementation of the algorithm is based on O'Rourke's @cite ORourke86 and Klee and Laskowski's @cite KleeLaskowski85 papers. O'Rourke provides a \f$\theta(n)\f$ algorithm for finding the minimal enclosing triangle of a 2D convex polygon with n vertices. Since the #minEnclosingTriangle function takes a 2D point set as input an additional preprocessing step of computing the convex hull of the 2D point set is required. The complexity of the #convexHull function is \f$O(n log(n))\f$ which is higher than \f$\theta(n)\f$. Thus the overall complexity of the function is \f$O(n log(n))\f$.

Positional Arguments
  • points: UMat.
Keyword Arguments
  • triangle: UMat.

Finds a triangle of minimum area enclosing a 2D point set and returns its area. The function finds a triangle of minimum area enclosing the given set of 2D points and returns its area. The output for a given 2D point set is shown in the image below. 2D points are depicted in red and the enclosing triangle in yellow*. Sample output of the minimum enclosing triangle function The implementation of the algorithm is based on O'Rourke's @cite ORourke86 and Klee and Laskowski's @cite KleeLaskowski85 papers. O'Rourke provides a \f$\theta(n)\f$ algorithm for finding the minimal enclosing triangle of a 2D convex polygon with n vertices. Since the #minEnclosingTriangle function takes a 2D point set as input an additional preprocessing step of computing the convex hull of the 2D point set is required. The complexity of the #convexHull function is \f$O(n log(n))\f$ which is higher than \f$\theta(n)\f$. Thus the overall complexity of the function is \f$O(n log(n))\f$.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • mask: UMat.

Finds the global minimum and maximum in an array. The function cv::minMaxLoc finds the minimum and maximum element values and their positions. The extremums are searched across the whole array or, if mask is not an empty array, in the specified array region. The function do not work with multi-channel arrays. If you need to find minimum or maximum elements across all the channels, use Mat::reshape first to reinterpret the array as single-channel. Or you may extract the particular channel using either extractImageCOI , or mixChannels , or split . @sa max, min, reduceArgMin, reduceArgMax, compare, inRange, extractImageCOI, mixChannels, split, Mat::reshape

Positional Arguments
  • src: UMat.
Keyword Arguments
  • mask: UMat.

Finds the global minimum and maximum in an array. The function cv::minMaxLoc finds the minimum and maximum element values and their positions. The extremums are searched across the whole array or, if mask is not an empty array, in the specified array region. The function do not work with multi-channel arrays. If you need to find minimum or maximum elements across all the channels, use Mat::reshape first to reinterpret the array as single-channel. Or you may extract the particular channel using either extractImageCOI , or mixChannels , or split . @sa max, min, reduceArgMin, reduceArgMax, compare, inRange, extractImageCOI, mixChannels, split, Mat::reshape

Has overloading in C++

Positional Arguments
  • array: UMat.
Keyword Arguments
  • binaryImage: bool.

Calculates all of the moments up to the third order of a polygon or rasterized shape. The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The results are returned in the structure cv::Moments.

Positional Arguments
  • array: UMat.
Keyword Arguments
  • binaryImage: bool.

Calculates all of the moments up to the third order of a polygon or rasterized shape. The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The results are returned in the structure cv::Moments.

Positional Arguments
  • src: UMat.
  • op: int.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • iterations: int.
  • borderType: int.
  • borderValue: Scalar.

Performs advanced morphological transformations. The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as basic operations. Any of the operations can be done in-place. In case of multi-channel images, each channel is processed independently.

Positional Arguments
  • src: UMat.
  • op: int.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • iterations: int.
  • borderType: int.
  • borderValue: Scalar.

Performs advanced morphological transformations. The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as basic operations. Any of the operations can be done in-place. In case of multi-channel images, each channel is processed independently.

Moves the window to the specified position

Positional Arguments
  • a: UMat.
  • b: UMat.
  • flags: int.
Keyword Arguments
  • c: UMat.
  • conjB: bool.

Performs the per-element multiplication of two Fourier spectrums. The function cv::mulSpectrums performs the per-element multiplication of the two CCS-packed or complex matrices that are results of a real or complex Fourier transform. The function, together with dft and idft , may be used to calculate convolution (pass conjB=false ) or correlation (pass conjB=true ) of two arrays rapidly. When the arrays are complex, they are simply multiplied (per element) with an optional conjugation of the second-array elements. When the arrays are real, they are assumed to be CCS-packed (see dft for details).

Positional Arguments
  • a: UMat.
  • b: UMat.
  • flags: int.
Keyword Arguments
  • c: UMat.
  • conjB: bool.

Performs the per-element multiplication of two Fourier spectrums. The function cv::mulSpectrums performs the per-element multiplication of the two CCS-packed or complex matrices that are results of a real or complex Fourier transform. The function, together with dft and idft , may be used to calculate convolution (pass conjB=false ) or correlation (pass conjB=true ) of two arrays rapidly. When the arrays are complex, they are simply multiplied (per element) with an optional conjugation of the second-array elements. When the arrays are real, they are assumed to be CCS-packed (see dft for details).

Positional Arguments
  • src: UMat.
  • aTa: bool.
Keyword Arguments
  • dst: UMat.
  • delta: UMat.
  • scale: double.
  • dtype: int.

Calculates the product of a matrix and its transposition. The function cv::mulTransposed calculates the product of src and its transposition: \f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\f] if aTa=true , and \f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\f] otherwise. The function is used to calculate the covariance matrix. With zero delta, it can be used as a faster substitute for general matrix product A*B when B=A'

Positional Arguments
  • src: UMat.
  • aTa: bool.
Keyword Arguments
  • dst: UMat.
  • delta: UMat.
  • scale: double.
  • dtype: int.

Calculates the product of a matrix and its transposition. The function cv::mulTransposed calculates the product of src and its transposition: \f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\f] if aTa=true , and \f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\f] otherwise. The function is used to calculate the covariance matrix. With zero delta, it can be used as a faster substitute for general matrix product A*B when B=A'

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • scale: double.
  • dtype: int.

Calculates the per-element scaled product of two arrays. The function multiply calculates the per-element product of two arrays: \f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I) \cdot \texttt{src2} (I))\f] There is also a @ref MatrixExpressions -friendly variant of the first function. See Mat::mul . For a not-per-element matrix product, see gemm . Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow. @sa add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare, Mat::convertTo

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • scale: double.
  • dtype: int.

Calculates the per-element scaled product of two arrays. The function multiply calculates the per-element product of two arrays: \f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I) \cdot \texttt{src2} (I))\f] There is also a @ref MatrixExpressions -friendly variant of the first function. See Mat::mul . For a not-per-element matrix product, see gemm . Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow. @sa add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare, Mat::convertTo

Positional Arguments
  • winname: String.
Keyword Arguments
  • flags: int.

Creates a window. The function namedWindow creates a window that can be used as a placeholder for images and trackbars. Created windows are referred to by their names. If a window with the same name already exists, the function does nothing. You can call cv::destroyWindow or cv::destroyAllWindows to close the window and de-allocate any associated memory usage. For a simple program, you do not really have to call these functions because all the resources and windows of the application are closed automatically by the operating system upon exit. Note: Qt backend supports additional flags

Positional Arguments
  • winname: String.
Keyword Arguments
  • flags: int.

Creates a window. The function namedWindow creates a window that can be used as a placeholder for images and trackbars. Created windows are referred to by their names. If a window with the same name already exists, the function does nothing. You can call cv::destroyWindow or cv::destroyAllWindows to close the window and de-allocate any associated memory usage. For a simple program, you do not really have to call these functions because all the resources and windows of the application are closed automatically by the operating system upon exit. Note: Qt backend supports additional flags

Positional Arguments
  • src1: UMat.
Keyword Arguments
  • normType: int.
  • mask: UMat.

Calculates the absolute norm of an array. This version of #norm calculates the absolute norm of src1. The type of norm to calculate is specified using #NormTypes. As example for one array consider the function \f$r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\f$. The \f$ L_{1}, L_{2} \f$ and \f$ L_{\infty} \f$ norm for the sample value \f$r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\f$ is calculated as follows \f{align} \| r(-1) \|{L_1} &= |-1| + |2| = 3 \\ \| r(-1) \|{L2} &= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\ \| r(-1) \|{L_\infty} &= \max(|-1|,|2|) = 2 \f} and for \f$r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\f$ the calculation is \f{align} \| r(0.5) \|{L_1} &= |0.5| + |0.5| = 1 \\ \| r(0.5) \|{L2} &= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\ \| r(0.5) \|{L\infty} &= \max(|0.5|,|0.5|) = 0.5. \f} The following graphic shows all values for the three norm functions \f$\| r(x) \|\{L_1}, \| r(x) \|_{L_2}\f$ and \f$\| r(x) \|_{L_\infty}\f$. It is notable that the \f$ L_{1} \f$ norm forms the upper and the \f$ L_{\infty} \f$ norm forms the lower border for the example function \f$ r(x) \f$. Graphs for the different norm functions from the above example When the mask parameter is specified and it is not empty, the norm is If normType is not specified, #NORM_L2 is used. calculated only over the region specified by the mask. Multi-channel input arrays are treated as single-channel arrays, that is, the results for all channels are combined. Hamming norms can only be calculated with CV_8U depth arrays.

Variaint 1:

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • normType: int.
  • mask: UMat.

Calculates an absolute difference norm or a relative difference norm. This version of cv::norm calculates the absolute difference norm or the relative difference norm of arrays src1 and src2. The type of norm to calculate is specified using #NormTypes.

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • normType: int.
  • mask: UMat.

Calculates an absolute difference norm or a relative difference norm. This version of cv::norm calculates the absolute difference norm or the relative difference norm of arrays src1 and src2. The type of norm to calculate is specified using #NormTypes.

Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • alpha: double.
  • beta: double.
  • norm_type: int.
  • dtype: int.
  • mask: UMat.

Normalizes the norm or value range of an array. The function cv::normalize normalizes scale and shift the input array elements so that \f[\| \texttt{dst} \| _{L_p}= \texttt{alpha}\f] (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that \f[\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\f] when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or min-max but modify the whole array, you can use norm and Mat::convertTo. In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this, the range transformation for sparse matrices is not allowed since it can shift the zero level. Possible usage with some positive example data

Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • alpha: double.
  • beta: double.
  • norm_type: int.
  • dtype: int.
  • mask: UMat.

Normalizes the norm or value range of an array. The function cv::normalize normalizes scale and shift the input array elements so that \f[\| \texttt{dst} \| _{L_p}= \texttt{alpha}\f] (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that \f[\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\f] when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or min-max but modify the whole array, you can use norm and Mat::convertTo. In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this, the range transformation for sparse matrices is not allowed since it can shift the zero level. Possible usage with some positive example data

Positional Arguments
  • a: UMat.
Keyword Arguments
  • val: double.

converts NaNs to the given number

Positional Arguments
  • a: UMat.
Keyword Arguments
  • val: double.

converts NaNs to the given number

Positional Arguments
  • data: UMat
  • mean: UMat
  • eigenvectors: UMat
Keyword Arguments
  • result: UMat.

Positional Arguments
  • data: UMat
  • mean: UMat
  • eigenvectors: UMat
Keyword Arguments
  • result: UMat.

Positional Arguments
  • data: UMat
  • mean: UMat
Keyword Arguments
  • eigenvectors: UMat.

Variaint 1:

Positional Arguments
  • data: UMat
  • mean: UMat
  • retainedVariance: double
Keyword Arguments
  • eigenvectors: UMat.

Positional Arguments
  • data: UMat
  • mean: UMat
  • retainedVariance: double
Keyword Arguments
  • eigenvectors: UMat.

Positional Arguments
  • data: UMat
  • mean: UMat
Keyword Arguments
  • eigenvectors: UMat.

Variaint 1:

Positional Arguments
  • data: UMat
  • mean: UMat
  • retainedVariance: double
Keyword Arguments
  • eigenvectors: UMat.

Positional Arguments
  • data: UMat
  • mean: UMat
  • retainedVariance: double
Keyword Arguments
  • eigenvectors: UMat.

Positional Arguments
  • data: UMat
  • mean: UMat
  • eigenvectors: UMat
Keyword Arguments
  • result: UMat.

Positional Arguments
  • data: UMat
  • mean: UMat
  • eigenvectors: UMat
Keyword Arguments
  • result: UMat.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst1: UMat.
  • dst2: UMat.
  • sigma_s: float.
  • sigma_r: float.
  • shade_factor: float.

Pencil-like non-photorealistic line drawing

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst1: UMat.
  • dst2: UMat.
  • sigma_s: float.
  • sigma_r: float.
  • shade_factor: float.

Pencil-like non-photorealistic line drawing

Positional Arguments
  • src: UMat.
  • m: UMat.
Keyword Arguments
  • dst: UMat.

Performs the perspective matrix transformation of vectors. The function cv::perspectiveTransform transforms every element of src by treating it as a 2D or 3D vector, in the following way: \f[(x, y, z) \rightarrow (x'/w, y'/w, z'/w)\f] where \f[(x', y', z', w') = \texttt{mat} \cdot \begin{bmatrix} x & y & z & 1 \end{bmatrix}\f] and \f[w = \fork{w'}{if (w' \ne 0)}{\infty}{otherwise}\f] Here a 3D vector transformation is shown. In case of a 2D vector transformation, the z component is omitted. Note: The function transforms a sparse set of 2D or 3D vectors. If you want to transform an image using perspective transformation, use warpPerspective . If you have an inverse problem, that is, you want to compute the most probable perspective transformation out of several pairs of corresponding points, you can use getPerspectiveTransform or findHomography .

Positional Arguments
  • src: UMat.
  • m: UMat.
Keyword Arguments
  • dst: UMat.

Performs the perspective matrix transformation of vectors. The function cv::perspectiveTransform transforms every element of src by treating it as a 2D or 3D vector, in the following way: \f[(x, y, z) \rightarrow (x'/w, y'/w, z'/w)\f] where \f[(x', y', z', w') = \texttt{mat} \cdot \begin{bmatrix} x & y & z & 1 \end{bmatrix}\f] and \f[w = \fork{w'}{if (w' \ne 0)}{\infty}{otherwise}\f] Here a 3D vector transformation is shown. In case of a 2D vector transformation, the z component is omitted. Note: The function transforms a sparse set of 2D or 3D vectors. If you want to transform an image using perspective transformation, use warpPerspective . If you have an inverse problem, that is, you want to compute the most probable perspective transformation out of several pairs of corresponding points, you can use getPerspectiveTransform or findHomography .

Positional Arguments
  • x: UMat.
  • y: UMat.
Keyword Arguments
  • angle: UMat.
  • angleInDegrees: bool.

Calculates the rotation angle of 2D vectors. The function cv::phase calculates the rotation angle of each 2D vector that is formed from the corresponding elements of x and y : \f[\texttt{angle} (I) = \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))\f] The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0 , the corresponding angle(I) is set to 0.

Positional Arguments
  • x: UMat.
  • y: UMat.
Keyword Arguments
  • angle: UMat.
  • angleInDegrees: bool.

Calculates the rotation angle of 2D vectors. The function cv::phase calculates the rotation angle of each 2D vector that is formed from the corresponding elements of x and y : \f[\texttt{angle} (I) = \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))\f] The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0 , the corresponding angle(I) is set to 0.

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • window: UMat.

The function is used to detect translational shifts that occur between two images. The operation takes advantage of the Fourier shift theorem for detecting the translational shift in the frequency domain. It can be used for fast image registration as well as motion estimation. For more information please see http://en.wikipedia.org/wiki/Phase_correlation Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed with getOptimalDFTSize. The function performs the following equations

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • window: UMat.

The function is used to detect translational shifts that occur between two images. The operation takes advantage of the Fourier shift theorem for detecting the translational shift in the frequency domain. It can be used for fast image registration as well as motion estimation. For more information please see http://en.wikipedia.org/wiki/Phase_correlation Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed with getOptimalDFTSize. The function performs the following equations

Performs a point-in-contour test. The function determines whether the point is inside a contour, outside, or lies on an edge (or coincides with a vertex). It returns positive (inside), negative (outside), or zero (on an edge) value, correspondingly. When measureDist=false , the return value is +1, -1, and 0, respectively. Otherwise, the return value is a signed distance between the point and the nearest contour edge. See below a sample output of the function where each image pixel is tested against the contour: sample output

Positional Arguments
  • magnitude: UMat.
  • angle: UMat.
Keyword Arguments
  • x: UMat.
  • y: UMat.
  • angleInDegrees: bool.

Calculates x and y coordinates of 2D vectors from their magnitude and angle. The function cv::polarToCart calculates the Cartesian coordinates of each 2D vector represented by the corresponding elements of magnitude and angle: \f[\begin{array}{l} \texttt{x} (I) = \texttt{magnitude} (I) \cos ( \texttt{angle} (I)) \\ \texttt{y} (I) = \texttt{magnitude} (I) \sin ( \texttt{angle} (I)) \\ \end{array}\f] The relative accuracy of the estimated coordinates is about 1e-6.

Positional Arguments
  • magnitude: UMat.
  • angle: UMat.
Keyword Arguments
  • x: UMat.
  • y: UMat.
  • angleInDegrees: bool.

Calculates x and y coordinates of 2D vectors from their magnitude and angle. The function cv::polarToCart calculates the Cartesian coordinates of each 2D vector represented by the corresponding elements of magnitude and angle: \f[\begin{array}{l} \texttt{x} (I) = \texttt{magnitude} (I) \cos ( \texttt{angle} (I)) \\ \texttt{y} (I) = \texttt{magnitude} (I) \sin ( \texttt{angle} (I)) \\ \end{array}\f] The relative accuracy of the estimated coordinates is about 1e-6.

Polls for a pressed key. The function pollKey polls for a key event without waiting. It returns the code of the pressed key or -1 if no key was pressed since the last invocation. To wait until a key was pressed, use #waitKey. Note: The functions #waitKey and #pollKey are the only methods in HighGUI that can fetch and handle GUI events, so one of them needs to be called periodically for normal event processing unless HighGUI is used within an environment that takes care of event processing. Note: The function only works if there is at least one HighGUI window created and the window is active. If there are several HighGUI windows, any of them can be active.

Positional Arguments
  • img: UMat. Image.
  • pts: vector_UMat.
  • isClosed: bool.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws several polygonal curves.

Positional Arguments
  • img: UMat. Image.
  • pts: vector_UMat.
  • isClosed: bool.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws several polygonal curves.

Positional Arguments
  • src: UMat.
  • power: double.
Keyword Arguments
  • dst: UMat.

Raises every array element to a power. The function cv::pow raises every element of the input array to power : \f[\texttt{dst} (I) = \fork{\texttt{src}(I)^{power}}{if (\texttt{power}) is integer}{|\texttt{src}(I)|^{power}}{otherwise}\f] So, for a non-integer power exponent, the absolute values of input array elements are used. However, it is possible to get true values for negative values using some extra operations. In the example below, computing the 5th root of array src shows

Positional Arguments
  • src: UMat.
  • power: double.
Keyword Arguments
  • dst: UMat.

Raises every array element to a power. The function cv::pow raises every element of the input array to power : \f[\texttt{dst} (I) = \fork{\texttt{src}(I)^{power}}{if (\texttt{power}) is integer}{|\texttt{src}(I)|^{power}}{otherwise}\f] So, for a non-integer power exponent, the absolute values of input array elements are used. However, it is possible to get true values for negative values using some extra operations. In the example below, computing the 5th root of array src shows

Positional Arguments
  • src: UMat.
  • ksize: int.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Calculates a feature map for corner detection. The function calculates the complex spatial derivative-based function of the source image \f[\texttt{dst} = (D_x \texttt{src} )^2 \cdot D_{yy} \texttt{src} + (D_y \texttt{src} )^2 \cdot D_{xx} \texttt{src} - 2 D_x \texttt{src} \cdot D_y \texttt{src} \cdot D_{xy} \texttt{src}\f] where \f$D_x\f$,\f$D_y\f$ are the first image derivatives, \f$D_{xx}\f$,\f$D_{yy}\f$ are the second image derivatives, and \f$D_{xy}\f$ is the mixed derivative. The corners can be found as local maximums of the functions, as shown below

Positional Arguments
  • src: UMat.
  • ksize: int.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Calculates a feature map for corner detection. The function calculates the complex spatial derivative-based function of the source image \f[\texttt{dst} = (D_x \texttt{src} )^2 \cdot D_{yy} \texttt{src} + (D_y \texttt{src} )^2 \cdot D_{xx} \texttt{src} - 2 D_x \texttt{src} \cdot D_y \texttt{src} \cdot D_{xy} \texttt{src}\f] where \f$D_x\f$,\f$D_y\f$ are the first image derivatives, \f$D_{xx}\f$,\f$D_{yy}\f$ are the second image derivatives, and \f$D_{xy}\f$ is the mixed derivative. The corners can be found as local maximums of the functions, as shown below

Positional Arguments
  • objectPoints: UMat.
  • rvec: UMat.
  • tvec: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • imagePoints: UMat.
  • jacobian: UMat.
  • aspectRatio: double.

Projects 3D points to an image plane.

Positional Arguments
  • objectPoints: UMat.
  • rvec: UMat.
  • tvec: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • imagePoints: UMat.
  • jacobian: UMat.
  • aspectRatio: double.

Projects 3D points to an image plane.

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • r: double.

Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric. This function calculates the Peak Signal-to-Noise Ratio (PSNR) image quality metric in decibels (dB), between two input arrays src1 and src2. The arrays must have the same type. The PSNR is calculated as follows: \f[ \texttt{PSNR} = 10 \cdot \log_{10}{\left( \frac{R^2}{MSE} \right) } \f] where R is the maximum integer value of depth (e.g. 255 in the case of CV_8U data) and MSE is the mean squared error between the two arrays.

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • r: double.

Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric. This function calculates the Peak Signal-to-Noise Ratio (PSNR) image quality metric in decibels (dB), between two input arrays src1 and src2. The arrays must have the same type. The PSNR is calculated as follows: \f[ \texttt{PSNR} = 10 \cdot \log_{10}{\left( \frac{R^2}{MSE} \right) } \f] where R is the maximum integer value of depth (e.g. 255 in the case of CV_8U data) and MSE is the mean squared error between the two arrays.

Positional Arguments
  • img: UMat. Image.
  • text: String.
  • org: Point.
  • fontFace: int.
  • fontScale: double.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • bottomLeftOrigin: bool.

Draws a text string. The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by question marks. See #getTextSize for a text rendering code example.

Positional Arguments
  • img: UMat. Image.
  • text: String.
  • org: Point.
  • fontFace: int.
  • fontScale: double.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • bottomLeftOrigin: bool.

Draws a text string. The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by question marks. See #getTextSize for a text rendering code example.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • dstsize: Size.
  • borderType: int.

Blurs an image and downsamples it. By default, size of the output image is computed as Size((src.cols+1)/2, (src.rows+1)/2), but in any case, the following conditions should be satisfied: \f[\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\f] The function performs the downsampling step of the Gaussian pyramid construction. First, it convolves the source image with the kernel: \f[\frac{1}{256} \begin{bmatrix} 1 & 4 & 6 & 4 & 1 \\ 4 & 16 & 24 & 16 & 4 \\ 6 & 24 & 36 & 24 & 6 \\ 4 & 16 & 24 & 16 & 4 \\ 1 & 4 & 6 & 4 & 1 \end{bmatrix}\f] Then, it downsamples the image by rejecting even rows and columns.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • dstsize: Size.
  • borderType: int.

Blurs an image and downsamples it. By default, size of the output image is computed as Size((src.cols+1)/2, (src.rows+1)/2), but in any case, the following conditions should be satisfied: \f[\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\f] The function performs the downsampling step of the Gaussian pyramid construction. First, it convolves the source image with the kernel: \f[\frac{1}{256} \begin{bmatrix} 1 & 4 & 6 & 4 & 1 \\ 4 & 16 & 24 & 16 & 4 \\ 6 & 24 & 36 & 24 & 6 \\ 4 & 16 & 24 & 16 & 4 \\ 1 & 4 & 6 & 4 & 1 \end{bmatrix}\f] Then, it downsamples the image by rejecting even rows and columns.

Positional Arguments
  • src: UMat.
  • sp: double.
  • sr: double.
Keyword Arguments
  • dst: UMat.
  • maxLevel: int.
  • termcrit: TermCriteria.

Performs initial step of meanshift segmentation of an image. The function implements the filtering stage of meanshift segmentation, that is, the output of the function is the filtered "posterized" image with color gradients and fine-grain texture flattened. At every pixel (X,Y) of the input image (or down-sized input image, see below) the function executes meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is considered: \f[(x,y): X- \texttt{sp} \le x \le X+ \texttt{sp} , Y- \texttt{sp} \le y \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)|| \le \texttt{sr}\f] where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively (though, the algorithm does not depend on the color space used, so any 3-component color space can be used instead). Over the neighborhood the average spatial value (X',Y') and average color vector (R',G',B') are found and they act as the neighborhood center on the next iteration: \f[(X,Y)~(X',Y'), (R,G,B)~(R',G',B').\f] After the iterations over, the color components of the initial pixel (that is, the pixel from where the iterations started) are set to the final value (average color at the last iteration): \f[I(X,Y) <- (R*,G*,B*)\f] When maxLevel > 0, the gaussian pyramid of maxLevel+1 levels is built, and the above procedure is run on the smallest layer first. After that, the results are propagated to the larger layer and the iterations are run again only on those pixels where the layer colors differ by more than sr from the lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the results will be actually different from the ones obtained by running the meanshift procedure on the whole original image (i.e. when maxLevel==0).

Positional Arguments
  • src: UMat.
  • sp: double.
  • sr: double.
Keyword Arguments
  • dst: UMat.
  • maxLevel: int.
  • termcrit: TermCriteria.

Performs initial step of meanshift segmentation of an image. The function implements the filtering stage of meanshift segmentation, that is, the output of the function is the filtered "posterized" image with color gradients and fine-grain texture flattened. At every pixel (X,Y) of the input image (or down-sized input image, see below) the function executes meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is considered: \f[(x,y): X- \texttt{sp} \le x \le X+ \texttt{sp} , Y- \texttt{sp} \le y \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)|| \le \texttt{sr}\f] where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively (though, the algorithm does not depend on the color space used, so any 3-component color space can be used instead). Over the neighborhood the average spatial value (X',Y') and average color vector (R',G',B') are found and they act as the neighborhood center on the next iteration: \f[(X,Y)~(X',Y'), (R,G,B)~(R',G',B').\f] After the iterations over, the color components of the initial pixel (that is, the pixel from where the iterations started) are set to the final value (average color at the last iteration): \f[I(X,Y) <- (R*,G*,B*)\f] When maxLevel > 0, the gaussian pyramid of maxLevel+1 levels is built, and the above procedure is run on the smallest layer first. After that, the results are propagated to the larger layer and the iterations are run again only on those pixels where the layer colors differ by more than sr from the lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the results will be actually different from the ones obtained by running the meanshift procedure on the whole original image (i.e. when maxLevel==0).

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • dstsize: Size.
  • borderType: int.

Upsamples an image and then blurs it. By default, size of the output image is computed as Size(src.cols\*2, (src.rows\*2), but in any case, the following conditions should be satisfied: \f[\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\f] The function performs the upsampling step of the Gaussian pyramid construction, though it can actually be used to construct the Laplacian pyramid. First, it upsamples the source image by injecting even zero rows and columns and then convolves the result with the same kernel as in pyrDown multiplied by 4.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • dstsize: Size.
  • borderType: int.

Upsamples an image and then blurs it. By default, size of the output image is computed as Size(src.cols\*2, (src.rows\*2), but in any case, the following conditions should be satisfied: \f[\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\f] The function performs the upsampling step of the Gaussian pyramid construction, though it can actually be used to construct the Laplacian pyramid. First, it upsamples the source image by injecting even zero rows and columns and then convolves the result with the same kernel as in pyrDown multiplied by 4.

Fills the array with normally distributed random numbers. The function cv::randn fills the matrix dst with normally distributed random numbers with the specified mean vector and the standard deviation matrix. The generated random numbers are clipped to fit the value range of the output array data type.

Positional Arguments
  • dst: UMat.
Keyword Arguments
  • iterFactor: double.

Shuffles the array elements randomly. The function cv::randShuffle shuffles the specified 1D array by randomly choosing pairs of elements and swapping them. The number of such swap operations will be dst.rows*dst.cols*iterFactor .

Positional Arguments
  • dst: UMat.
Keyword Arguments
  • iterFactor: double.

Shuffles the array elements randomly. The function cv::randShuffle shuffles the specified 1D array by randomly choosing pairs of elements and swapping them. The number of such swap operations will be dst.rows*dst.cols*iterFactor .

Generates a single uniformly-distributed random number or an array of random numbers. Non-template variant of the function fills the matrix dst with uniformly-distributed random numbers from the specified range: \f[\texttt{low} _c \leq \texttt{dst} (I)_c < \texttt{high} _c\f] @sa RNG, randn, theRNG

Read a .flo file The function readOpticalFlow loads a flow field from a file and returns it as a single matrix. Resulting Mat has a type CV_32FC2 - floating-point, 2-channel. First channel corresponds to the flow in the horizontal direction (u), second - vertical (v).

Positional Arguments
  • e: UMat.
  • points1: UMat.
  • points2: UMat.
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • focal: double.
  • pp: Point2d.
  • mask: UMat.

Has overloading in C++

Variaint 1:

Positional Arguments
  • e: UMat.
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix: UMat.
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • mask: UMat.

Recovers the relative camera rotation and the translation from an estimated essential matrix and the corresponding points in two images, using cheirality check. Returns the number of inliers that pass the check.

Variaint 1:

Positional Arguments
  • e: UMat.
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix: UMat.
  • distanceThresh: double.
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • mask: UMat.
  • triangulatedPoints: UMat.

Has overloading in C++

Variaint 1:

Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
Keyword Arguments
  • e: UMat.
  • r: UMat.
  • t: UMat.
  • method: int.
  • prob: double.
  • threshold: double.
  • mask: UMat.

Recovers the relative camera rotation and the translation from corresponding points in two images from two different cameras, using cheirality check. Returns the number of inliers that pass the check.

Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
Keyword Arguments
  • e: UMat.
  • r: UMat.
  • t: UMat.
  • method: int.
  • prob: double.
  • threshold: double.
  • mask: UMat.

Recovers the relative camera rotation and the translation from corresponding points in two images from two different cameras, using cheirality check. Returns the number of inliers that pass the check.

Positional Arguments
  • img: UMat
  • rec: Rect
  • color: Scalar
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Has overloading in C++

Variaint 1:

Positional Arguments
  • img: UMat. Image.
  • pt1: Point.
  • pt2: Point.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a simple, thick, or filled up-right rectangle. The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners are pt1 and pt2.

Positional Arguments
  • img: UMat. Image.
  • pt1: Point.
  • pt2: Point.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a simple, thick, or filled up-right rectangle. The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners are pt1 and pt2.

Positional Arguments
  • cameraMatrix1: UMat
  • distCoeffs1: UMat
  • cameraMatrix2: UMat
  • distCoeffs2: UMat
  • cameraMatrix3: UMat
  • distCoeffs3: UMat
  • imgpt1: vector_UMat
  • imgpt3: vector_UMat
  • imageSize: Size
  • r12: UMat
  • t12: UMat
  • r13: UMat
  • t13: UMat
  • alpha: double
  • newImgSize: Size
  • flags: int
Keyword Arguments
  • r1: UMat.
  • r2: UMat.
  • r3: UMat.
  • p1: UMat.
  • p2: UMat.
  • p3: UMat.
  • q: UMat.

Python prototype (for reference):

Positional Arguments
  • cameraMatrix1: UMat
  • distCoeffs1: UMat
  • cameraMatrix2: UMat
  • distCoeffs2: UMat
  • cameraMatrix3: UMat
  • distCoeffs3: UMat
  • imgpt1: vector_UMat
  • imgpt3: vector_UMat
  • imageSize: Size
  • r12: UMat
  • t12: UMat
  • r13: UMat
  • t13: UMat
  • alpha: double
  • newImgSize: Size
  • flags: int
Keyword Arguments
  • r1: UMat.
  • r2: UMat.
  • r3: UMat.
  • p1: UMat.
  • p2: UMat.
  • p3: UMat.
  • q: UMat.

Python prototype (for reference):

Positional Arguments
  • src: UMat.
  • dim: int.
  • rtype: int.
Keyword Arguments
  • dst: UMat.
  • dtype: int.

Reduces a matrix to a vector. The function #reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained. For example, the function can be used to compute horizontal and vertical projections of a raster image. In case of #REDUCE_MAX and #REDUCE_MIN , the output image should have the same type as the source one. In case of #REDUCE_SUM and #REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction modes. The following code demonstrates its usage for a single channel matrix. @snippet snippets/core_reduce.cpp example And the following code demonstrates its usage for a two-channel matrix. @snippet snippets/core_reduce.cpp example2

Positional Arguments
  • src: UMat.
  • dim: int.
  • rtype: int.
Keyword Arguments
  • dst: UMat.
  • dtype: int.

Reduces a matrix to a vector. The function #reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained. For example, the function can be used to compute horizontal and vertical projections of a raster image. In case of #REDUCE_MAX and #REDUCE_MIN , the output image should have the same type as the source one. In case of #REDUCE_SUM and #REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction modes. The following code demonstrates its usage for a single channel matrix. @snippet snippets/core_reduce.cpp example And the following code demonstrates its usage for a two-channel matrix. @snippet snippets/core_reduce.cpp example2

Positional Arguments
  • src: UMat.
  • axis: int.
Keyword Arguments
  • dst: UMat.
  • lastIndex: bool.

Finds indices of max elements along provided axis Note:

Positional Arguments
  • src: UMat.
  • axis: int.
Keyword Arguments
  • dst: UMat.
  • lastIndex: bool.

Finds indices of max elements along provided axis Note:

Positional Arguments
  • src: UMat.
  • axis: int.
Keyword Arguments
  • dst: UMat.
  • lastIndex: bool.

Finds indices of min elements along provided axis Note:

Positional Arguments
  • src: UMat.
  • axis: int.
Keyword Arguments
  • dst: UMat.
  • lastIndex: bool.

Finds indices of min elements along provided axis Note:

Positional Arguments
  • src: UMat.
  • map1: UMat.
  • map2: UMat.
  • interpolation: int.
Keyword Arguments
  • dst: UMat.
  • borderMode: int.
  • borderValue: Scalar.

Applies a generic geometrical transformation to an image. The function remap transforms the source image using the specified map: \f[\texttt{dst} (x,y) = \texttt{src} (map_x(x,y),map_y(x,y))\f] where values of pixels with non-integer coordinates are computed using one of available interpolation methods. \f$map_x\f$ and \f$map_y\f$ can be encoded as separate floating-point maps in \f$map_1\f$ and \f$map_2\f$ respectively, or interleaved floating-point maps of \f$(x,y)\f$ in \f$map_1\f$, or fixed-point maps created by using #convertMaps. The reason you might want to convert from floating to fixed-point representations of a map is that they can yield much faster (\~2x) remapping operations. In the converted case, \f$map_1\f$ contains pairs (cvFloor(x), cvFloor(y)) and \f$map_2\f$ contains indices in a table of interpolation coefficients. This function cannot operate in-place.

Positional Arguments
  • src: UMat.
  • map1: UMat.
  • map2: UMat.
  • interpolation: int.
Keyword Arguments
  • dst: UMat.
  • borderMode: int.
  • borderValue: Scalar.

Applies a generic geometrical transformation to an image. The function remap transforms the source image using the specified map: \f[\texttt{dst} (x,y) = \texttt{src} (map_x(x,y),map_y(x,y))\f] where values of pixels with non-integer coordinates are computed using one of available interpolation methods. \f$map_x\f$ and \f$map_y\f$ can be encoded as separate floating-point maps in \f$map_1\f$ and \f$map_2\f$ respectively, or interleaved floating-point maps of \f$(x,y)\f$ in \f$map_1\f$, or fixed-point maps created by using #convertMaps. The reason you might want to convert from floating to fixed-point representations of a map is that they can yield much faster (\~2x) remapping operations. In the converted case, \f$map_1\f$ contains pairs (cvFloor(x), cvFloor(y)) and \f$map_2\f$ contains indices in a table of interpolation coefficients. This function cannot operate in-place.

Positional Arguments
  • src: UMat.
  • ny: int.
  • nx: int.
Keyword Arguments
  • dst: UMat.

Fills the output array with repeated copies of the input array. The function cv::repeat duplicates the input array one or more times along each of the two axes: \f[\texttt{dst} _{ij}= \texttt{src} _{i\mod src.rows, \; j\mod src.cols }\f] The second variant of the function is more convenient to use with @ref MatrixExpressions.

Positional Arguments
  • src: UMat.
  • ny: int.
  • nx: int.
Keyword Arguments
  • dst: UMat.

Fills the output array with repeated copies of the input array. The function cv::repeat duplicates the input array one or more times along each of the two axes: \f[\texttt{dst} _{ij}= \texttt{src} _{i\mod src.rows, \; j\mod src.cols }\f] The second variant of the function is more convenient to use with @ref MatrixExpressions.

Positional Arguments
  • disparity: UMat.
  • q: UMat.
Keyword Arguments
  • 3dImage: UMat.
  • handleMissingValues: bool.
  • ddepth: int.

Reprojects a disparity image to 3D space.

Positional Arguments
  • disparity: UMat.
  • q: UMat.
Keyword Arguments
  • 3dImage: UMat.
  • handleMissingValues: bool.
  • ddepth: int.

Reprojects a disparity image to 3D space.

Positional Arguments
  • src: UMat.
  • dsize: Size.
Keyword Arguments
  • dst: UMat.
  • fx: double.
  • fy: double.
  • interpolation: int.

Resizes an image. The function resize resizes the image src down to or up to the specified size. Note that the initial dst type or size are not taken into account. Instead, the size and type are derived from the src,dsize,fx, and fy. If you want to resize src so that it fits the pre-created dst, you may call the function as follows

Positional Arguments
  • src: UMat.
  • dsize: Size.
Keyword Arguments
  • dst: UMat.
  • fx: double.
  • fy: double.
  • interpolation: int.

Resizes an image. The function resize resizes the image src down to or up to the specified size. Note that the initial dst type or size are not taken into account. Instead, the size and type are derived from the src,dsize,fx, and fy. If you want to resize src so that it fits the pre-created dst, you may call the function as follows

Has overloading in C++

Resizes the window to the specified size Note:

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • jacobian: UMat.

Converts a rotation matrix to a rotation vector or vice versa.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • jacobian: UMat.

Converts a rotation matrix to a rotation vector or vice versa.

Positional Arguments
  • src: UMat.
  • rotateCode: int.
Keyword Arguments
  • dst: UMat.

Rotates a 2D array in multiples of 90 degrees. The function cv::rotate rotates the array in one of three different ways

Positional Arguments
  • src: UMat.
  • rotateCode: int.
Keyword Arguments
  • dst: UMat.

Rotates a 2D array in multiples of 90 degrees. The function cv::rotate rotates the array in one of three different ways

Positional Arguments
  • rect1: RotatedRect.
  • rect2: RotatedRect.
Keyword Arguments
  • intersectingRegion: UMat.

Finds out if there is any intersection between two rotated rectangles. If there is then the vertices of the intersecting region are returned as well. Below are some examples of intersection configurations. The hatched pattern indicates the intersecting region and the red vertices are returned by the function. intersection examples

Positional Arguments
  • rect1: RotatedRect.
  • rect2: RotatedRect.
Keyword Arguments
  • intersectingRegion: UMat.

Finds out if there is any intersection between two rotated rectangles. If there is then the vertices of the intersecting region are returned as well. Below are some examples of intersection configurations. The hatched pattern indicates the intersecting region and the red vertices are returned by the function. intersection examples

Positional Arguments
  • src: UMat.
Keyword Arguments
  • mtxR: UMat.
  • mtxQ: UMat.
  • qx: UMat.
  • qy: UMat.
  • qz: UMat.

Computes an RQ decomposition of 3x3 matrices. The function computes a RQ decomposition using the given rotations. This function is used in #decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera and a rotation matrix. It optionally returns three rotation matrices, one for each axis, and the three Euler angles in degrees (as the return value) that could be used in OpenGL. Note, there is always more than one sequence of rotations about the three principal axes that results in the same orientation of an object, e.g. see @cite Slabaugh . Returned tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • mtxR: UMat.
  • mtxQ: UMat.
  • qx: UMat.
  • qy: UMat.
  • qz: UMat.

Computes an RQ decomposition of 3x3 matrices. The function computes a RQ decomposition using the given rotations. This function is used in #decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera and a rotation matrix. It optionally returns three rotation matrices, one for each axis, and the three Euler angles in degrees (as the return value) that could be used in OpenGL. Note, there is always more than one sequence of rotations about the three principal axes that results in the same orientation of an object, e.g. see @cite Slabaugh . Returned tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.

Calculates the Sampson Distance between two points. The function cv::sampsonDistance calculates and returns the first order approximation of the geometric error as: \f[ sd( \texttt{pt1} , \texttt{pt2} )= \frac{(\texttt{pt2}^t \cdot \texttt{F} \cdot \texttt{pt1})^2} {((\texttt{F} \cdot \texttt{pt1})(0))^2 + ((\texttt{F} \cdot \texttt{pt1})(1))^2 + ((\texttt{F}^t \cdot \texttt{pt2})(0))^2 + ((\texttt{F}^t \cdot \texttt{pt2})(1))^2} \f] The fundamental matrix may be calculated using the #findFundamentalMat function. See @cite HartleyZ00 11.4.3 for details. @return The computed Sampson distance.

Positional Arguments
  • src1: UMat.
  • alpha: double.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the sum of a scaled array and another array. The function scaleAdd is one of the classical primitive linear algebra operations, known as DAXPY or SAXPY in BLAS. It calculates the sum of a scaled array and another array: \f[\texttt{dst} (I)= \texttt{scale} \cdot \texttt{src1} (I) + \texttt{src2} (I)\f] The function can also be emulated with a matrix expression, for example

Positional Arguments
  • src1: UMat.
  • alpha: double.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the sum of a scaled array and another array. The function scaleAdd is one of the classical primitive linear algebra operations, known as DAXPY or SAXPY in BLAS. It calculates the sum of a scaled array and another array: \f[\texttt{dst} (I)= \texttt{scale} \cdot \texttt{src1} (I) + \texttt{src2} (I)\f] The function can also be emulated with a matrix expression, for example

Positional Arguments
  • src: UMat.
  • ddepth: int.
  • dx: int.
  • dy: int.
Keyword Arguments
  • dst: UMat.
  • scale: double.
  • delta: double.
  • borderType: int.

Calculates the first x- or y- image derivative using Scharr operator. The function computes the first x- or y- spatial image derivative using the Scharr operator. The call \f[\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\f] is equivalent to \f[\texttt{Sobel(src, dst, ddepth, dx, dy, FILTER_SCHARR, scale, delta, borderType)} .\f]

Positional Arguments
  • src: UMat.
  • ddepth: int.
  • dx: int.
  • dy: int.
Keyword Arguments
  • dst: UMat.
  • scale: double.
  • delta: double.
  • borderType: int.

Calculates the first x- or y- image derivative using Scharr operator. The function computes the first x- or y- spatial image derivative using the Scharr operator. The call \f[\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\f] is equivalent to \f[\texttt{Sobel(src, dst, ddepth, dx, dy, FILTER_SCHARR, scale, delta, borderType)} .\f]

Positional Arguments
  • src: UMat.
  • dst: UMat.
  • mask: UMat.
  • p: Point.
  • flags: int.
Keyword Arguments
  • blend: UMat.

Image editing tasks concern either global changes (color/intensity corrections, filters, deformations) or local changes concerned to a selection. Here we are interested in achieving local changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless manner. The extent of the changes ranges from slight distortions to complete replacement by novel content @cite PM03 .

Positional Arguments
  • src: UMat.
  • dst: UMat.
  • mask: UMat.
  • p: Point.
  • flags: int.
Keyword Arguments
  • blend: UMat.

Image editing tasks concern either global changes (color/intensity corrections, filters, deformations) or local changes concerned to a selection. Here we are interested in achieving local changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless manner. The extent of the changes ranges from slight distortions to complete replacement by novel content @cite PM03 .

Positional Arguments
  • img: UMat
Keyword Arguments
  • showCrosshair: bool.
  • fromCenter: bool.

Has overloading in C++

Variaint 1:

Positional Arguments
  • windowName: String.
  • img: UMat.
Keyword Arguments
  • showCrosshair: bool.
  • fromCenter: bool.

Allows users to select a ROI on the given image. The function creates a window and allows users to select a ROI using the mouse. Controls: use space or enter to finish selection, use key c to cancel selection (function will return the zero cv::Rect).

Positional Arguments
  • windowName: String.
  • img: UMat.
Keyword Arguments
  • showCrosshair: bool.
  • fromCenter: bool.

Allows users to select a ROI on the given image. The function creates a window and allows users to select a ROI using the mouse. Controls: use space or enter to finish selection, use key c to cancel selection (function will return the zero cv::Rect).

Positional Arguments
  • windowName: String.
  • img: UMat.
Keyword Arguments
  • showCrosshair: bool.
  • fromCenter: bool.

Allows users to select multiple ROIs on the given image. The function creates a window and allows users to select multiple ROIs using the mouse. Controls: use space or enter to finish current selection and start a new one, use esc to terminate multiple ROI selection process.

Positional Arguments
  • windowName: String.
  • img: UMat.
Keyword Arguments
  • showCrosshair: bool.
  • fromCenter: bool.

Allows users to select multiple ROIs on the given image. The function creates a window and allows users to select multiple ROIs using the mouse. Controls: use space or enter to finish current selection and start a new one, use esc to terminate multiple ROI selection process.

Positional Arguments
  • src: UMat.
  • ddepth: int.
  • kernelX: UMat.
  • kernelY: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • delta: double.
  • borderType: int.

Applies a separable linear filter to an image. The function applies a separable linear filter to the image. That is, first, every row of src is filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D kernel kernelY. The final result shifted by delta is stored in dst .

Positional Arguments
  • src: UMat.
  • ddepth: int.
  • kernelX: UMat.
  • kernelY: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • delta: double.
  • borderType: int.

Applies a separable linear filter to an image. The function applies a separable linear filter to the image. That is, first, every row of src is filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D kernel kernelY. The final result shifted by delta is stored in dst .

Positional Arguments
  • mtx: UMat.
Keyword Arguments
  • s: Scalar.

Initializes a scaled identity matrix. The function cv::setIdentity initializes a scaled identity matrix: \f[\texttt{mtx} (i,j)= \fork{\texttt{value}}{ if (i=j)}{0}{otherwise}\f] The function can also be emulated using the matrix initializers and the matrix expressions

Positional Arguments
  • mtx: UMat.
Keyword Arguments
  • s: Scalar.

Initializes a scaled identity matrix. The function cv::setIdentity initializes a scaled identity matrix: \f[\texttt{mtx} (i,j)= \fork{\texttt{value}}{ if (i=j)}{0}{otherwise}\f] The function can also be emulated using the matrix initializers and the matrix expressions

Python prototype (for reference):

OpenCV will try to set the number of threads for the next parallel region. If threads == 0, OpenCV will disable threading optimizations and run all it's functions sequentially. Passing threads \< 0 will reset threads number to system default. This function must be called outside of parallel region. OpenCV will try to run its functions with specified threads number, but some behaviour differs from framework

Sets state of default random number generator. The function cv::setRNGSeed sets state of default random number generator to custom value. @sa RNG, randu, randn

Sets the trackbar maximum position. The function sets the maximum position of the specified trackbar in the specified window. Note: [Qt Backend Only] winname can be empty if the trackbar is attached to the control panel.

Sets the trackbar minimum position. The function sets the minimum position of the specified trackbar in the specified window. Note: [Qt Backend Only] winname can be empty if the trackbar is attached to the control panel.

Sets the trackbar position. The function sets the position of the specified trackbar in the specified window. Note: [Qt Backend Only] winname can be empty if the trackbar is attached to the control panel.

Python prototype (for reference):

Enables or disables the optimized code. The function can be used to dynamically turn on and off optimized dispatched code (code that uses SSE4.2, AVX/AVX2, and other instructions on the platforms that support it). It sets a global flag that is further checked by OpenCV functions. Since the flag is not checked in the inner OpenCV loops, it is only safe to call the function on the very top level in your application where you can be sure that no other OpenCV function is currently executed. By default, the optimized code is enabled unless you disable it in CMake. The current status can be retrieved using useOptimized.

Changes parameters of a window dynamically. The function setWindowProperty enables changing properties of a window.

Updates window title

Positional Arguments
  • src: UMat.
  • ddepth: int.
  • dx: int.
  • dy: int.
Keyword Arguments
  • dst: UMat.
  • ksize: int.
  • scale: double.
  • delta: double.
  • borderType: int.

Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator. In all cases except one, the \f$\texttt{ksize} \times \texttt{ksize}\f$ separable kernel is used to calculate the derivative. When \f$\texttt{ksize = 1}\f$, the \f$3 \times 1\f$ or \f$1 \times 3\f$ kernel is used (that is, no Gaussian smoothing is done). ksize = 1 can only be used for the first or the second x- or y- derivatives. There is also the special value ksize = #FILTER_SCHARR (-1) that corresponds to the \f$3\times3\f$ Scharr filter that may give more accurate results than the \f$3\times3\f$ Sobel. The Scharr aperture is \f[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\f] for the x-derivative, or transposed for the y-derivative. The function calculates an image derivative by convolving the image with the appropriate kernel: \f[\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\f] The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3) or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first case corresponds to a kernel of: \f[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\f] The second case corresponds to a kernel of: \f[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\f]

Positional Arguments
  • src: UMat.
  • ddepth: int.
  • dx: int.
  • dy: int.
Keyword Arguments
  • dst: UMat.
  • ksize: int.
  • scale: double.
  • delta: double.
  • borderType: int.

Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator. In all cases except one, the \f$\texttt{ksize} \times \texttt{ksize}\f$ separable kernel is used to calculate the derivative. When \f$\texttt{ksize = 1}\f$, the \f$3 \times 1\f$ or \f$1 \times 3\f$ kernel is used (that is, no Gaussian smoothing is done). ksize = 1 can only be used for the first or the second x- or y- derivatives. There is also the special value ksize = #FILTER_SCHARR (-1) that corresponds to the \f$3\times3\f$ Scharr filter that may give more accurate results than the \f$3\times3\f$ Sobel. The Scharr aperture is \f[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\f] for the x-derivative, or transposed for the y-derivative. The function calculates an image derivative by convolving the image with the appropriate kernel: \f[\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\f] The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3) or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first case corresponds to a kernel of: \f[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\f] The second case corresponds to a kernel of: \f[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\f]

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Solves one or more linear systems or least-squares problems. The function cv::solve solves a linear system or least-squares problem (the latter is possible with SVD or QR methods, or by specifying the flag #DECOMP_NORMAL ): \f[\texttt{dst} = \arg \min _X \| \texttt{src1} \cdot \texttt{X} - \texttt{src2} \|\f] If #DECOMP_LU or #DECOMP_CHOLESKY method is used, the function returns 1 if src1 (or \f$\texttt{src1}^T\texttt{src1}\f$ ) is non-singular. Otherwise, it returns 0. In the latter case, dst is not valid. Other methods find a pseudo-solution in case of a singular left-hand side part. Note: If you want to find a unity-norm solution of an under-defined singular system \f$\texttt{src1}\cdot\texttt{dst}=0\f$ , the function solve will not do the work. Use SVD::solveZ instead. @sa invert, SVD, eigen

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Solves one or more linear systems or least-squares problems. The function cv::solve solves a linear system or least-squares problem (the latter is possible with SVD or QR methods, or by specifying the flag #DECOMP_NORMAL ): \f[\texttt{dst} = \arg \min _X \| \texttt{src1} \cdot \texttt{X} - \texttt{src2} \|\f] If #DECOMP_LU or #DECOMP_CHOLESKY method is used, the function returns 1 if src1 (or \f$\texttt{src1}^T\texttt{src1}\f$ ) is non-singular. Otherwise, it returns 0. In the latter case, dst is not valid. Other methods find a pseudo-solution in case of a singular left-hand side part. Note: If you want to find a unity-norm solution of an under-defined singular system \f$\texttt{src1}\cdot\texttt{dst}=0\f$ , the function solve will not do the work. Use SVD::solveZ instead. @sa invert, SVD, eigen

Positional Arguments
  • coeffs: UMat.
Keyword Arguments
  • roots: UMat.

Finds the real roots of a cubic equation. The function solveCubic finds the real roots of a cubic equation

Positional Arguments
  • coeffs: UMat.
Keyword Arguments
  • roots: UMat.

Finds the real roots of a cubic equation. The function solveCubic finds the real roots of a cubic equation

Positional Arguments
  • func: UMat.
  • constr: UMat.
Keyword Arguments
  • z: UMat.

Solve given (non-integer) linear programming problem using the Simplex Algorithm (Simplex Method). What we mean here by "linear programming problem" (or LP problem, for short) can be formulated as: \f[\mbox{Maximize } c\cdot x\\ \mbox{Subject to:}\\ Ax\leq b\\ x\geq 0\f] Where \f$c\f$ is fixed 1-by-n row-vector, \f$A\f$ is fixed m-by-n matrix, \f$b\f$ is fixed m-by-1 column vector and \f$x\f$ is an arbitrary n-by-1 column vector, which satisfies the constraints. Simplex algorithm is one of many algorithms that are designed to handle this sort of problems efficiently. Although it is not optimal in theoretical sense (there exist algorithms that can solve any problem written as above in polynomial time, while simplex method degenerates to exponential time for some special cases), it is well-studied, easy to implement and is shown to work well for real-life purposes. The particular implementation is taken almost verbatim from Introduction to Algorithms, third edition by T. H. Cormen, C. E. Leiserson, R. L. Rivest and Clifford Stein. In particular, the Bland's rule http://en.wikipedia.org/wiki/Bland%27s_rule is used to prevent cycling.

Positional Arguments
  • func: UMat.
  • constr: UMat.
Keyword Arguments
  • z: UMat.

Solve given (non-integer) linear programming problem using the Simplex Algorithm (Simplex Method). What we mean here by "linear programming problem" (or LP problem, for short) can be formulated as: \f[\mbox{Maximize } c\cdot x\\ \mbox{Subject to:}\\ Ax\leq b\\ x\geq 0\f] Where \f$c\f$ is fixed 1-by-n row-vector, \f$A\f$ is fixed m-by-n matrix, \f$b\f$ is fixed m-by-1 column vector and \f$x\f$ is an arbitrary n-by-1 column vector, which satisfies the constraints. Simplex algorithm is one of many algorithms that are designed to handle this sort of problems efficiently. Although it is not optimal in theoretical sense (there exist algorithms that can solve any problem written as above in polynomial time, while simplex method degenerates to exponential time for some special cases), it is well-studied, easy to implement and is shown to work well for real-life purposes. The particular implementation is taken almost verbatim from Introduction to Algorithms, third edition by T. H. Cormen, C. E. Leiserson, R. L. Rivest and Clifford Stein. In particular, the Bland's rule http://en.wikipedia.org/wiki/Bland%27s_rule is used to prevent cycling.

Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • flags: int.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.

Finds an object pose from 3 3D-2D point correspondences. @see @ref calib3d_solvePnP

Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • flags: int.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.

Finds an object pose from 3 3D-2D point correspondences. @see @ref calib3d_solvePnP

Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvec: UMat.
  • tvec: UMat.
  • useExtrinsicGuess: bool.
  • flags: int.

Finds an object pose from 3D-2D point correspondences. @see @ref calib3d_solvePnP This function returns the rotation and the translation vectors that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame, using different methods

Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvec: UMat.
  • tvec: UMat.
  • useExtrinsicGuess: bool.
  • flags: int.

Finds an object pose from 3D-2D point correspondences. @see @ref calib3d_solvePnP This function returns the rotation and the translation vectors that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame, using different methods

Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • useExtrinsicGuess: bool.
  • flags: SolvePnPMethod.
  • rvec: UMat.
  • tvec: UMat.
  • reprojectionError: UMat.

Finds an object pose from 3D-2D point correspondences. @see @ref calib3d_solvePnP This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector> couple), depending on the number of input points and the chosen method

Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • useExtrinsicGuess: bool.
  • flags: SolvePnPMethod.
  • rvec: UMat.
  • tvec: UMat.
  • reprojectionError: UMat.

Finds an object pose from 3D-2D point correspondences. @see @ref calib3d_solvePnP This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector> couple), depending on the number of input points and the chosen method

Positional Arguments
  • objectPoints: UMat
  • imagePoints: UMat
  • cameraMatrix: UMat
  • distCoeffs: UMat
Keyword Arguments
  • rvec: UMat.
  • tvec: UMat.
  • inliers: UMat.
  • params: UsacParams.

Python prototype (for reference):

Positional Arguments
  • objectPoints: UMat
  • imagePoints: UMat
  • cameraMatrix: UMat
  • distCoeffs: UMat
Keyword Arguments
  • rvec: UMat.
  • tvec: UMat.
  • inliers: UMat.
  • params: UsacParams.

Python prototype (for reference):

Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • rvec: UMat.
  • tvec: UMat.
Keyword Arguments
  • criteria: TermCriteria.

Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution. @see @ref calib3d_solvePnP

Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • rvec: UMat.
  • tvec: UMat.
Keyword Arguments
  • criteria: TermCriteria.

Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution. @see @ref calib3d_solvePnP

Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • rvec: UMat.
  • tvec: UMat.
Keyword Arguments
  • criteria: TermCriteria.
  • vVSlambda: double.

Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution. @see @ref calib3d_solvePnP

Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • rvec: UMat.
  • tvec: UMat.
Keyword Arguments
  • criteria: TermCriteria.
  • vVSlambda: double.

Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution. @see @ref calib3d_solvePnP

Positional Arguments
  • coeffs: UMat.
Keyword Arguments
  • roots: UMat.
  • maxIters: int.

Finds the real or complex roots of a polynomial equation. The function cv::solvePoly finds real and complex roots of a polynomial equation: \f[\texttt{coeffs} [n] x^{n} + \texttt{coeffs} [n-1] x^{n-1} + ... + \texttt{coeffs} [1] x + \texttt{coeffs} [0] = 0\f]

Positional Arguments
  • coeffs: UMat.
Keyword Arguments
  • roots: UMat.
  • maxIters: int.

Finds the real or complex roots of a polynomial equation. The function cv::solvePoly finds real and complex roots of a polynomial equation: \f[\texttt{coeffs} [n] x^{n} + \texttt{coeffs} [n-1] x^{n-1} + ... + \texttt{coeffs} [1] x + \texttt{coeffs} [0] = 0\f]

Positional Arguments
  • src: UMat.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Sorts each row or each column of a matrix. The function cv::sort sorts each matrix row or each matrix column in ascending or descending order. So you should pass two operation flags to get desired behaviour. If you want to sort matrix rows or columns lexicographically, you can use STL std::sort generic function with the proper comparison predicate. @sa sortIdx, randShuffle

Positional Arguments
  • src: UMat.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Sorts each row or each column of a matrix. The function cv::sort sorts each matrix row or each matrix column in ascending or descending order. So you should pass two operation flags to get desired behaviour. If you want to sort matrix rows or columns lexicographically, you can use STL std::sort generic function with the proper comparison predicate. @sa sortIdx, randShuffle

Positional Arguments
  • src: UMat.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Sorts each row or each column of a matrix. The function cv::sortIdx sorts each matrix row or each matrix column in the ascending or descending order. So you should pass two operation flags to get desired behaviour. Instead of reordering the elements themselves, it stores the indices of sorted elements in the output array. For example

Positional Arguments
  • src: UMat.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Sorts each row or each column of a matrix. The function cv::sortIdx sorts each matrix row or each matrix column in the ascending or descending order. So you should pass two operation flags to get desired behaviour. Instead of reordering the elements themselves, it stores the indices of sorted elements in the output array. For example

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dx: UMat.
  • dy: UMat.
  • ksize: int.
  • borderType: int.

Calculates the first order image derivative in both x and y using a Sobel operator Equivalent to calling

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dx: UMat.
  • dy: UMat.
  • ksize: int.
  • borderType: int.

Calculates the first order image derivative in both x and y using a Sobel operator Equivalent to calling

Positional Arguments
  • m: UMat.
Keyword Arguments
  • mv: vector_UMat.

Has overloading in C++

Positional Arguments
  • m: UMat.
Keyword Arguments
  • mv: vector_UMat.

Has overloading in C++

Positional Arguments
  • src: UMat.
  • ddepth: int.
  • ksize: Size.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • normalize: bool.
  • borderType: int.

Calculates the normalized sum of squares of the pixel values overlapping the filter. For every pixel \f$ (x, y) \f$ in the source image, the function calculates the sum of squares of those neighboring pixel values which overlap the filter placed over the pixel \f$ (x, y) \f$. The unnormalized square box filter can be useful in computing local image statistics such as the local variance and standard deviation around the neighborhood of a pixel.

Positional Arguments
  • src: UMat.
  • ddepth: int.
  • ksize: Size.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • normalize: bool.
  • borderType: int.

Calculates the normalized sum of squares of the pixel values overlapping the filter. For every pixel \f$ (x, y) \f$ in the source image, the function calculates the sum of squares of those neighboring pixel values which overlap the filter placed over the pixel \f$ (x, y) \f$. The unnormalized square box filter can be useful in computing local image statistics such as the local variance and standard deviation around the neighborhood of a pixel.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Calculates a square root of array elements. The function cv::sqrt calculates a square root of each input array element. In case of multi-channel arrays, each channel is processed independently. The accuracy is approximately the same as of the built-in std::sqrt .

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Calculates a square root of array elements. The function cv::sqrt calculates a square root of each input array element. In case of multi-channel arrays, each channel is processed independently. The accuracy is approximately the same as of the built-in std::sqrt .

Python prototype (for reference):

Positional Arguments
  • objectPoints: vector_UMat
  • imagePoints1: vector_UMat
  • imagePoints2: vector_UMat
  • cameraMatrix1: UMat
  • distCoeffs1: UMat
  • cameraMatrix2: UMat
  • distCoeffs2: UMat
  • imageSize: Size
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • e: UMat.
  • f: UMat.
  • flags: int.
  • criteria: TermCriteria.

Python prototype (for reference):

Positional Arguments
  • objectPoints: vector_UMat
  • imagePoints1: vector_UMat
  • imagePoints2: vector_UMat
  • cameraMatrix1: UMat
  • distCoeffs1: UMat
  • cameraMatrix2: UMat
  • distCoeffs2: UMat
  • imageSize: Size
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • e: UMat.
  • f: UMat.
  • flags: int.
  • criteria: TermCriteria.

Python prototype (for reference):

Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints1: vector_UMat.
  • imagePoints2: vector_UMat.
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
  • imageSize: Size.
  • r: UMat.
  • t: UMat.
Keyword Arguments
  • e: UMat.
  • f: UMat.
  • perViewErrors: UMat.
  • flags: int.
  • criteria: TermCriteria.

Calibrates a stereo camera set up. This function finds the intrinsic parameters for each of the two cameras and the extrinsic parameters between the two cameras.

Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints1: vector_UMat.
  • imagePoints2: vector_UMat.
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
  • imageSize: Size.
  • r: UMat.
  • t: UMat.
Keyword Arguments
  • e: UMat.
  • f: UMat.
  • perViewErrors: UMat.
  • flags: int.
  • criteria: TermCriteria.

Calibrates a stereo camera set up. This function finds the intrinsic parameters for each of the two cameras and the extrinsic parameters between the two cameras.

Positional Arguments
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
  • imageSize: Size.
  • r: UMat.
  • t: UMat.
Keyword Arguments
  • r1: UMat.
  • r2: UMat.
  • p1: UMat.
  • p2: UMat.
  • q: UMat.
  • flags: int.
  • alpha: double.
  • newImageSize: Size.

Computes rectification transforms for each head of a calibrated stereo camera.

Positional Arguments
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
  • imageSize: Size.
  • r: UMat.
  • t: UMat.
Keyword Arguments
  • r1: UMat.
  • r2: UMat.
  • p1: UMat.
  • p2: UMat.
  • q: UMat.
  • flags: int.
  • alpha: double.
  • newImageSize: Size.

Computes rectification transforms for each head of a calibrated stereo camera.

Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • f: UMat.
  • imgSize: Size.
Keyword Arguments
  • h1: UMat.
  • h2: UMat.
  • threshold: double.

Computes a rectification transform for an uncalibrated stereo camera.

Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • f: UMat.
  • imgSize: Size.
Keyword Arguments
  • h1: UMat.
  • h2: UMat.
  • threshold: double.

Computes a rectification transform for an uncalibrated stereo camera.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • sigma_s: float.
  • sigma_r: float.

Stylization aims to produce digital imagery with a wide variety of effects not focused on photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low contrast while preserving, or enhancing, high-contrast features.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • sigma_s: float.
  • sigma_r: float.

Stylization aims to produce digital imagery with a wide variety of effects not focused on photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low contrast while preserving, or enhancing, high-contrast features.

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • mask: UMat.
  • dtype: int.

Calculates the per-element difference between two arrays or array and a scalar. The function subtract calculates

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • mask: UMat.
  • dtype: int.

Calculates the per-element difference between two arrays or array and a scalar. The function subtract calculates

Calculates the sum of array elements. The function cv::sum calculates and returns the sum of array elements, independently for each channel. @sa countNonZero, mean, meanStdDev, norm, minMaxLoc, reduce

Positional Arguments
  • w: UMat
  • u: UMat
  • vt: UMat
  • rhs: UMat
Keyword Arguments
  • dst: UMat.

Positional Arguments
  • w: UMat
  • u: UMat
  • vt: UMat
  • rhs: UMat
Keyword Arguments
  • dst: UMat.

Positional Arguments
  • src: UMat
Keyword Arguments
  • w: UMat.

Positional Arguments
  • src: UMat
Keyword Arguments
  • w: UMat.

Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.
  • low_threshold: float.
  • high_threshold: float.
  • kernel_size: int.

By retaining only the gradients at edge locations, before integrating with the Poisson solver, one washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge %Detector is used. Note: The algorithm assumes that the color of the source image is close to that of the destination. This assumption means that when the colors don't match, the source image color gets tinted toward the color of the destination image.

Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.
  • low_threshold: float.
  • high_threshold: float.
  • kernel_size: int.

By retaining only the gradients at edge locations, before integrating with the Poisson solver, one washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge %Detector is used. Note: The algorithm assumes that the color of the source image is close to that of the destination. This assumption means that when the colors don't match, the source image color gets tinted toward the color of the destination image.

Positional Arguments
  • src: UMat.
  • thresh: double.
  • maxval: double.
  • type: int.
Keyword Arguments
  • dst: UMat.

Applies a fixed-level threshold to each array element. The function applies fixed-level thresholding to a multiple-channel array. The function is typically used to get a bi-level (binary) image out of a grayscale image ( #compare could be also used for this purpose) or for removing a noise, that is, filtering out pixels with too small or too large values. There are several types of thresholding supported by the function. They are determined by type parameter. Also, the special values #THRESH_OTSU or #THRESH_TRIANGLE may be combined with one of the above values. In these cases, the function determines the optimal threshold value using the Otsu's or Triangle algorithm and uses it instead of the specified thresh. Note: Currently, the Otsu's and Triangle methods are implemented only for 8-bit single-channel images.

Positional Arguments
  • src: UMat.
  • thresh: double.
  • maxval: double.
  • type: int.
Keyword Arguments
  • dst: UMat.

Applies a fixed-level threshold to each array element. The function applies fixed-level thresholding to a multiple-channel array. The function is typically used to get a bi-level (binary) image out of a grayscale image ( #compare could be also used for this purpose) or for removing a noise, that is, filtering out pixels with too small or too large values. There are several types of thresholding supported by the function. They are determined by type parameter. Also, the special values #THRESH_OTSU or #THRESH_TRIANGLE may be combined with one of the above values. In these cases, the function determines the optimal threshold value using the Otsu's or Triangle algorithm and uses it instead of the specified thresh. Note: Currently, the Otsu's and Triangle methods are implemented only for 8-bit single-channel images.

Returns the trace of a matrix. The function cv::trace returns the sum of the diagonal elements of the matrix mtx . \f[\mathrm{tr} ( \texttt{mtx} ) = \sum _i \texttt{mtx} (i,i)\f]

Positional Arguments
  • src: UMat.
  • m: UMat.
Keyword Arguments
  • dst: UMat.

Performs the matrix transformation of every array element. The function cv::transform performs the matrix transformation of every element of the array src and stores the results in dst : \f[\texttt{dst} (I) = \texttt{m} \cdot \texttt{src} (I)\f] (when m.cols=src.channels() ), or \f[\texttt{dst} (I) = \texttt{m} \cdot [ \texttt{src} (I); 1]\f] (when m.cols=src.channels()+1 ) Every element of the N -channel array src is interpreted as N -element vector that is transformed using the M x N or M x (N+1) matrix m to M-element vector - the corresponding element of the output array dst . The function may be used for geometrical transformation of N -dimensional points, arbitrary linear color space transformation (such as various kinds of RGB to YUV transforms), shuffling the image channels, and so forth.

Positional Arguments
  • src: UMat.
  • m: UMat.
Keyword Arguments
  • dst: UMat.

Performs the matrix transformation of every array element. The function cv::transform performs the matrix transformation of every element of the array src and stores the results in dst : \f[\texttt{dst} (I) = \texttt{m} \cdot \texttt{src} (I)\f] (when m.cols=src.channels() ), or \f[\texttt{dst} (I) = \texttt{m} \cdot [ \texttt{src} (I); 1]\f] (when m.cols=src.channels()+1 ) Every element of the N -channel array src is interpreted as N -element vector that is transformed using the M x N or M x (N+1) matrix m to M-element vector - the corresponding element of the output array dst . The function may be used for geometrical transformation of N -dimensional points, arbitrary linear color space transformation (such as various kinds of RGB to YUV transforms), shuffling the image channels, and so forth.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Transposes a matrix. The function cv::transpose transposes the matrix src : \f[\texttt{dst} (i,j) = \texttt{src} (j,i)\f] Note: No complex conjugation is done in case of a complex matrix. It should be done separately if needed.

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Transposes a matrix. The function cv::transpose transposes the matrix src : \f[\texttt{dst} (i,j) = \texttt{src} (j,i)\f] Note: No complex conjugation is done in case of a complex matrix. It should be done separately if needed.

Positional Arguments
  • src: UMat.
  • order: vector_int.
Keyword Arguments
  • dst: UMat.

Transpose for n-dimensional matrices. Note: Input should be continuous single-channel matrix.

Positional Arguments
  • src: UMat.
  • order: vector_int.
Keyword Arguments
  • dst: UMat.

Transpose for n-dimensional matrices. Note: Input should be continuous single-channel matrix.

Positional Arguments
  • projMatr1: UMat.
  • projMatr2: UMat.
  • projPoints1: UMat.
  • projPoints2: UMat.
Keyword Arguments
  • points4D: UMat.

This function reconstructs 3-dimensional points (in homogeneous coordinates) by using their observations with a stereo camera.

Positional Arguments
  • projMatr1: UMat.
  • projMatr2: UMat.
  • projPoints1: UMat.
  • projPoints2: UMat.
Keyword Arguments
  • points4D: UMat.

This function reconstructs 3-dimensional points (in homogeneous coordinates) by using their observations with a stereo camera.

Positional Arguments
  • src: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • dst: UMat.
  • newCameraMatrix: UMat.

Transforms an image to compensate for lens distortion. The function transforms an image to compensate radial and tangential lens distortion. The function is simply a combination of #initUndistortRectifyMap (with unity R ) and #remap (with bilinear interpolation). See the former function for details of the transformation being performed. Those pixels in the destination image, for which there is no correspondent pixels in the source image, are filled with zeros (black color). A particular subset of the source image that will be visible in the corrected image can be regulated by newCameraMatrix. You can use #getOptimalNewCameraMatrix to compute the appropriate newCameraMatrix depending on your requirements. The camera matrix and the distortion parameters can be determined using #calibrateCamera. If the resolution of images is different from the resolution used at the calibration stage, \f$f_x, f_y, c_x\f$ and \f$c_y\f$ need to be scaled accordingly, while the distortion coefficients remain the same.

Positional Arguments
  • src: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • dst: UMat.
  • newCameraMatrix: UMat.

Transforms an image to compensate for lens distortion. The function transforms an image to compensate radial and tangential lens distortion. The function is simply a combination of #initUndistortRectifyMap (with unity R ) and #remap (with bilinear interpolation). See the former function for details of the transformation being performed. Those pixels in the destination image, for which there is no correspondent pixels in the source image, are filled with zeros (black color). A particular subset of the source image that will be visible in the corrected image can be regulated by newCameraMatrix. You can use #getOptimalNewCameraMatrix to compute the appropriate newCameraMatrix depending on your requirements. The camera matrix and the distortion parameters can be determined using #calibrateCamera. If the resolution of images is different from the resolution used at the calibration stage, \f$f_x, f_y, c_x\f$ and \f$c_y\f$ need to be scaled accordingly, while the distortion coefficients remain the same.

Positional Arguments
  • src: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • dst: UMat.
  • arg1: TermCriteria.

Compute undistorted image points position

Positional Arguments
  • src: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • dst: UMat.
  • arg1: TermCriteria.

Compute undistorted image points position

Positional Arguments
  • src: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • dst: UMat.
  • r: UMat.
  • p: UMat.

Computes the ideal point coordinates from the observed point coordinates. The function is similar to #undistort and #initUndistortRectifyMap but it operates on a sparse set of points instead of a raster image. Also the function performs a reverse transformation to #projectPoints. In case of a 3D object, it does not reconstruct its 3D coordinates, but for a planar object, it does, up to a translation vector, if the proper R is specified. For each observed point coordinate \f$(u, v)\f$ the function computes: \f[ \begin{array}{l} x^{"} \leftarrow (u - c_x)/f_x \\ y^{"} \leftarrow (v - c_y)/f_y \\ (x',y') = undistort(x^{"},y^{"}, \texttt{distCoeffs}) \\ {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\ x \leftarrow X/W \\ y \leftarrow Y/W \\ \text{only performed if P is specified:} \\ u' \leftarrow x {f'}_x + {c'}_x \\ v' \leftarrow y {f'}_y + {c'}_y \end{array} \f] where undistort is an approximate iterative algorithm that estimates the normalized original point coordinates out of the normalized distorted point coordinates ("normalized" means that the coordinates do not depend on the camera matrix). The function can be used for both a stereo camera head or a monocular camera (when R is empty).

Positional Arguments
  • src: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • dst: UMat.
  • r: UMat.
  • p: UMat.

Computes the ideal point coordinates from the observed point coordinates. The function is similar to #undistort and #initUndistortRectifyMap but it operates on a sparse set of points instead of a raster image. Also the function performs a reverse transformation to #projectPoints. In case of a 3D object, it does not reconstruct its 3D coordinates, but for a planar object, it does, up to a translation vector, if the proper R is specified. For each observed point coordinate \f$(u, v)\f$ the function computes: \f[ \begin{array}{l} x^{"} \leftarrow (u - c_x)/f_x \\ y^{"} \leftarrow (v - c_y)/f_y \\ (x',y') = undistort(x^{"},y^{"}, \texttt{distCoeffs}) \\ {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\ x \leftarrow X/W \\ y \leftarrow Y/W \\ \text{only performed if P is specified:} \\ u' \leftarrow x {f'}_x + {c'}_x \\ v' \leftarrow y {f'}_y + {c'}_y \end{array} \f] where undistort is an approximate iterative algorithm that estimates the normalized original point coordinates out of the normalized distorted point coordinates ("normalized" means that the coordinates do not depend on the camera matrix). The function can be used for both a stereo camera head or a monocular camera (when R is empty).

Positional Arguments
  • src: UMat
  • cameraMatrix: UMat
  • distCoeffs: UMat
  • r: UMat
  • p: UMat
  • criteria: TermCriteria
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Positional Arguments
  • src: UMat
  • cameraMatrix: UMat
  • distCoeffs: UMat
  • r: UMat
  • p: UMat
  • criteria: TermCriteria
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Python prototype (for reference):

Returns the status of optimized code usage. The function returns true if the optimized code is enabled. Otherwise, it returns false.

Positional Arguments
  • disparity: UMat
  • cost: UMat
  • minDisparity: int
  • numberOfDisparities: int
Keyword Arguments
  • disp12MaxDisp: int.

Python prototype (for reference):

Positional Arguments
  • disparity: UMat
  • cost: UMat
  • minDisparity: int
  • numberOfDisparities: int
Keyword Arguments
  • disp12MaxDisp: int.

Python prototype (for reference):

Positional Arguments
  • src: vector_UMat.
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Positional Arguments
  • src: vector_UMat.
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Positional Arguments
Keyword Arguments
  • delay: int.

Similar to #waitKey, but returns full key code. Note: Key code is implementation specific and depends on used backend: QT/GTK/Win32/etc

Positional Arguments
Keyword Arguments
  • delay: int.

Similar to #waitKey, but returns full key code. Note: Key code is implementation specific and depends on used backend: QT/GTK/Win32/etc

Positional Arguments
  • src: UMat.
  • m: UMat.
  • dsize: Size.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • borderMode: int.
  • borderValue: Scalar.

Applies an affine transformation to an image. The function warpAffine transforms the source image using the specified matrix: \f[\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})\f] when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with #invertAffineTransform and then put in the formula above instead of M. The function cannot operate in-place.

Positional Arguments
  • src: UMat.
  • m: UMat.
  • dsize: Size.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • borderMode: int.
  • borderValue: Scalar.

Applies an affine transformation to an image. The function warpAffine transforms the source image using the specified matrix: \f[\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})\f] when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with #invertAffineTransform and then put in the formula above instead of M. The function cannot operate in-place.

Positional Arguments
  • src: UMat.
  • m: UMat.
  • dsize: Size.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • borderMode: int.
  • borderValue: Scalar.

Applies a perspective transformation to an image. The function warpPerspective transforms the source image using the specified matrix: \f[\texttt{dst} (x,y) = \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} , \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\f] when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert and then put in the formula above instead of M. The function cannot operate in-place.

Positional Arguments
  • src: UMat.
  • m: UMat.
  • dsize: Size.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • borderMode: int.
  • borderValue: Scalar.

Applies a perspective transformation to an image. The function warpPerspective transforms the source image using the specified matrix: \f[\texttt{dst} (x,y) = \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} , \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\f] when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert and then put in the formula above instead of M. The function cannot operate in-place.

Positional Arguments
  • src: UMat.
  • dsize: Size.
  • center: Point2f.
  • maxRadius: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Positional Arguments
  • src: UMat.
  • dsize: Size.
  • center: Point2f.
  • maxRadius: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Performs a marker-based image segmentation using the watershed algorithm. The function implements one of the variants of watershed, non-parametric marker-based segmentation algorithm, described in @cite Meyer92 . Before passing the image to the function, you have to roughly outline the desired regions in the image markers with positive (>0) indices. So, every region is represented as one or more connected components with the pixel values 1, 2, 3, and so on. Such markers can be retrieved from a binary mask using #findContours and #drawContours (see the watershed.cpp demo). The markers are "seeds" of the future image regions. All the other pixels in markers , whose relation to the outlined regions is not known and should be defined by the algorithm, should be set to 0's. In the function output, each pixel in markers is set to a value of the "seed" components or to -1 at boundaries between the regions. Note: Any two neighbor connected components are not necessarily separated by a watershed boundary (-1's pixels); for example, they can touch each other in the initial marker image passed to the function.

Write a .flo to disk The function stores a flow field in a file, returns true on success, false otherwise. The flow field must be a 2-channel, floating-point matrix (CV_32FC2). First channel corresponds to the flow in the horizontal direction (u), second - vertical (v).

Constants

Functions

return a list of enabled modules in this build

Raising version of absdiff/2.

Raising version of accumulate/2.

Raising version of add/2.

Raising version of add/3.

Raising version of blur/2.

Raising version of blur/3.

Raising version of boundingRect/1.

Raising version of boxPoints/1.

Raising version of boxPoints/2.

Raising version of cartToPolar/2.

Raising version of checkRange/1.

Raising version of checkRange/2.

Raising version of completeSymm/1.

Raising version of contourArea/1.

Raising version of convertFp16/1.

Raising version of convexHull/1.

Raising version of copyTo/2.

Raising version of copyTo/3.

Raising version of countNonZero/1.

Raising version of createAlignMTB/0.

Raising version of createCLAHE/0.

Raising version of createCLAHE/1.

Raising version of createTonemap/0.

Raising version of cubeRoot/1.

Raising version of cvtColor/2.

Raising version of dct/1.

Raising version of dct/2.

Raising version of decolor/1.

Raising version of decolor/2.

Raising version of detailEnhance/1.

Raising version of determinant/1.

Raising version of dft/1.

Raising version of dft/2.

Raising version of dilate/2.

Raising version of dilate/3.

Raising version of divide/2.

Raising version of divide/3.

Raising version of eigen/1.

Raising version of eigen/2.

Raising version of ellipse/3.

Raising version of equalizeHist/1.

Raising version of erode/2.

Raising version of erode/3.

Raising version of exp/1.

Raising version of exp/2.

Raising version of fastAtan2/2.

Raising version of findNonZero/1.

Raising version of fitEllipse/1.

Raising version of flip/2.

Raising version of flip/3.

Raising version of getLogLevel/0.

Raising version of getNumThreads/0.

Raising version of getThreadNum/0.

Raising version of getTickCount/0.

Raising version of haveOpenVX/0.

Raising version of hconcat/1.

Raising version of hconcat/2.

Raising version of huMoments/1.

Raising version of huMoments/2.

Raising version of idct/1.

Raising version of idct/2.

Raising version of idft/1.

Raising version of idft/2.

Raising version of imcount/1.

Raising version of imcount/2.

Raising version of imdecode/2.

Raising version of imencode/2.

Raising version of imread/1.

Raising version of imread/2.

Raising version of imwrite/2.

Raising version of integral2/1.

Raising version of integral2/2.

Raising version of integral3/1.

Raising version of integral3/2.

Raising version of integral/1.

Raising version of integral/2.

Raising version of invert/1.

Raising version of invert/2.

Raising version of laplacian/2.

Raising version of line/4.

Raising version of log/1.

Raising version of log/2.

Raising version of lut/2.

Raising version of lut/3.

Raising version of magnitude/2.

Raising version of magnitude/3.

Raising version of matMulDeriv/2.

Raising version of max/2.

Raising version of max/3.

Raising version of mean/1.

Raising version of mean/2.

Raising version of meanStdDev/1.

Raising version of meanStdDev/2.

Raising version of merge/1.

Raising version of merge/2.

Raising version of min/2.

Raising version of min/3.

Raising version of minAreaRect/1.

Raising version of minMaxLoc/1.

Raising version of minMaxLoc/2.

Raising version of moments/1.

Raising version of moments/2.

Raising version of multiply/2.

Raising version of namedWindow/1.

Raising version of norm/1.

Raising version of norm/2.

Raising version of norm/3.

Raising version of normalize/2.

Raising version of patchNaNs/1.

Raising version of patchNaNs/2.

Raising version of pencilSketch/1.

Raising version of phase/2.

Raising version of phase/3.

Raising version of pollKey/0.

Raising version of pow/2.

Raising version of pow/3.

Raising version of psnr/2.

Raising version of psnr/3.

Raising version of pyrDown/1.

Raising version of pyrDown/2.

Raising version of pyrUp/1.

Raising version of pyrUp/2.

Raising version of randn/3.

Raising version of randShuffle/1.

Raising version of randu/3.

Raising version of reduce/3.

Raising version of repeat/3.

Raising version of repeat/4.

Raising version of resize/2.

Raising version of resize/3.

Raising version of rodrigues/1.

Raising version of rodrigues/2.

Raising version of rotate/2.

Raising version of rqDecomp3x3/1.

Raising version of selectROI/1.

Raising version of setIdentity/1.

Raising version of setLogLevel/1.

Raising version of setRNGSeed/1.

Raising version of setUseOpenVX/1.

Raising version of sobel/4.

Raising version of solve/2.

Raising version of solve/3.

Raising version of solveCubic/1.

Raising version of solveLP/2.

Raising version of solvePoly/1.

Raising version of sort/2.

Raising version of sort/3.

Raising version of sortIdx/2.

Raising version of split/1.

Raising version of split/2.

Raising version of sqrt/1.

Raising version of sqrt/2.

Raising version of stylization/1.

Raising version of subtract/2.

Raising version of sumElems/1.

Raising version of svdDecomp/1.

Raising version of svdDecomp/2.

Raising version of trace/1.

Raising version of transform/2.

Raising version of transpose/1.

Raising version of transpose/2.

Raising version of useOpenVX/0.

Raising version of useOptimized/0.

Raising version of vconcat/1.

Raising version of vconcat/2.

Raising version of waitKeyEx/0.

Raising version of waitKeyEx/1.

Link to this section cv

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the per-element absolute difference between two arrays or between an array and a scalar. The function cv::absdiff calculates:

 Absolute difference between two arrays when they have the same

size and type: \f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2}(I)|)\f]

 Absolute difference between an array and a scalar when the second

array is constructed from Scalar or has as many elements as the number of channels in src1: \f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2} |)\f]

 Absolute difference between a scalar and an array when the first

array is constructed from Scalar or has as many elements as the number of channels in src2: \f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1} - \texttt{src2}(I) |)\f] where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. Note: Saturation is not applied when the arrays have the depth CV_32S. You may even get a negative value in the case of overflow. @sa cv::abs(const Mat&)

Python prototype (for reference):

absdiff(src1, src2[, dst]) -> dst
Link to this function

absdiff(src1, src2, opts)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the per-element absolute difference between two arrays or between an array and a scalar. The function cv::absdiff calculates:

 Absolute difference between two arrays when they have the same

size and type: \f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2}(I)|)\f]

 Absolute difference between an array and a scalar when the second

array is constructed from Scalar or has as many elements as the number of channels in src1: \f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1}(I) - \texttt{src2} |)\f]

 Absolute difference between a scalar and an array when the first

array is constructed from Scalar or has as many elements as the number of channels in src2: \f[\texttt{dst}(I) = \texttt{saturate} (| \texttt{src1} - \texttt{src2}(I) |)\f] where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. Note: Saturation is not applied when the arrays have the depth CV_32S. You may even get a negative value in the case of overflow. @sa cv::abs(const Mat&)

Python prototype (for reference):

absdiff(src1, src2[, dst]) -> dst
Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • mask: UMat.

Adds an image to the accumulator image. The function adds src or some of its elements to dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently. The function cv::accumulate can be used, for example, to collect statistics of a scene background viewed by a still camera and for the further foreground-background segmentation. @sa accumulateSquare, accumulateProduct, accumulateWeighted

Python prototype (for reference):

accumulate(src, dst[, mask]) -> dst
Link to this function

accumulate(src, dst, opts)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • mask: UMat.

Adds an image to the accumulator image. The function adds src or some of its elements to dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently. The function cv::accumulate can be used, for example, to collect statistics of a scene background viewed by a still camera and for the further foreground-background segmentation. @sa accumulateSquare, accumulateProduct, accumulateWeighted

Python prototype (for reference):

accumulate(src, dst[, mask]) -> dst
Link to this function

accumulateProduct(src1, src2, dst)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • dst: UMat.
Keyword Arguments
  • mask: UMat.

Adds the per-element product of two input images to the accumulator image. The function adds the product of two images or their selected regions to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src1} (x,y) \cdot \texttt{src2} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.

floating-point.

@sa accumulate, accumulateSquare, accumulateWeighted

Python prototype (for reference):

accumulateProduct(src1, src2, dst[, mask]) -> dst
Link to this function

accumulateProduct(src1, src2, dst, opts)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • dst: UMat.
Keyword Arguments
  • mask: UMat.

Adds the per-element product of two input images to the accumulator image. The function adds the product of two images or their selected regions to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src1} (x,y) \cdot \texttt{src2} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.

floating-point.

@sa accumulate, accumulateSquare, accumulateWeighted

Python prototype (for reference):

accumulateProduct(src1, src2, dst[, mask]) -> dst
Link to this function

accumulateSquare(src, dst)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • mask: UMat.

Adds the square of a source image to the accumulator image. The function adds the input image src or its selected region, raised to a power of 2, to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y)^2 \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.

floating-point.

@sa accumulateSquare, accumulateProduct, accumulateWeighted

Python prototype (for reference):

accumulateSquare(src, dst[, mask]) -> dst
Link to this function

accumulateSquare(src, dst, opts)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • mask: UMat.

Adds the square of a source image to the accumulator image. The function adds the input image src or its selected region, raised to a power of 2, to the accumulator dst : \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y)^2 \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] The function supports multi-channel images. Each channel is processed independently.

floating-point.

@sa accumulateSquare, accumulateProduct, accumulateWeighted

Python prototype (for reference):

accumulateSquare(src, dst[, mask]) -> dst
Link to this function

accumulateWeighted(src, dst, alpha)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
  • alpha: double.
Keyword Arguments
  • mask: UMat.

Updates a running average. The function calculates the weighted sum of the input image src and the accumulator dst so that dst becomes a running average of a frame sequence: \f[\texttt{dst} (x,y) \leftarrow (1- \texttt{alpha} ) \cdot \texttt{dst} (x,y) + \texttt{alpha} \cdot \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images). The function supports multi-channel images. Each channel is processed independently.

floating-point.

@sa accumulate, accumulateSquare, accumulateProduct

Python prototype (for reference):

accumulateWeighted(src, dst, alpha[, mask]) -> dst
Link to this function

accumulateWeighted(src, dst, alpha, opts)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
  • alpha: double.
Keyword Arguments
  • mask: UMat.

Updates a running average. The function calculates the weighted sum of the input image src and the accumulator dst so that dst becomes a running average of a frame sequence: \f[\texttt{dst} (x,y) \leftarrow (1- \texttt{alpha} ) \cdot \texttt{dst} (x,y) + \texttt{alpha} \cdot \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images). The function supports multi-channel images. Each channel is processed independently.

floating-point.

@sa accumulate, accumulateSquare, accumulateProduct

Python prototype (for reference):

accumulateWeighted(src, dst, alpha[, mask]) -> dst
Link to this function

adaptiveThreshold(src, maxValue, adaptiveMethod, thresholdType, blockSize, c)

View Source
Positional Arguments
  • src: UMat.
  • maxValue: double.
  • adaptiveMethod: int.
  • thresholdType: int.
  • blockSize: int.
  • c: double.
Keyword Arguments
  • dst: UMat.

Applies an adaptive threshold to an array. The function transforms a grayscale image to a binary image according to the formulae:

  • THRESH_BINARY \f[dst(x,y) = \fork{\texttt{maxValue}}{if (src(x,y) > T(x,y))}{0}{otherwise}\f]
  • THRESH_BINARY_INV \f[dst(x,y) = \fork{0}{if (src(x,y) > T(x,y))}{\texttt{maxValue}}{otherwise}\f] where \f$T(x,y)\f$ is a threshold calculated individually for each pixel (see adaptiveMethod parameter). The function can process the image in-place. The #BORDER_REPLICATE | #BORDER_ISOLATED is used to process boundaries. see #ThresholdTypes. pixel: 3, 5, 7, and so on. is positive but may be zero or negative as well. @sa threshold, blur, GaussianBlur

Python prototype (for reference):

adaptiveThreshold(src, maxValue, adaptiveMethod, thresholdType, blockSize, C[, dst]) -> dst
Link to this function

adaptiveThreshold(src, maxValue, adaptiveMethod, thresholdType, blockSize, c, opts)

View Source
Positional Arguments
  • src: UMat.
  • maxValue: double.
  • adaptiveMethod: int.
  • thresholdType: int.
  • blockSize: int.
  • c: double.
Keyword Arguments
  • dst: UMat.

Applies an adaptive threshold to an array. The function transforms a grayscale image to a binary image according to the formulae:

  • THRESH_BINARY \f[dst(x,y) = \fork{\texttt{maxValue}}{if (src(x,y) > T(x,y))}{0}{otherwise}\f]
  • THRESH_BINARY_INV \f[dst(x,y) = \fork{0}{if (src(x,y) > T(x,y))}{\texttt{maxValue}}{otherwise}\f] where \f$T(x,y)\f$ is a threshold calculated individually for each pixel (see adaptiveMethod parameter). The function can process the image in-place. The #BORDER_REPLICATE | #BORDER_ISOLATED is used to process boundaries. see #ThresholdTypes. pixel: 3, 5, 7, and so on. is positive but may be zero or negative as well. @sa threshold, blur, GaussianBlur

Python prototype (for reference):

adaptiveThreshold(src, maxValue, adaptiveMethod, thresholdType, blockSize, C[, dst]) -> dst
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • mask: UMat.
  • dtype: int.

Calculates the per-element sum of two arrays or an array and a scalar. The function add calculates:

  • Sum of two arrays when both input arrays have the same size and the same number of channels: \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\f]
  • Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of elements as src1.channels(): \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\f]
  • Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of elements as src2.channels(): \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} + \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\f] where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. The first function in the list above can be replaced with matrix expressions:
    dst = src1 + src2;
    dst += src1; // equivalent to add(dst, src1, dst);
    The input arrays and the output array can all have the same or different depths. For example, you can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit floating-point array. Depth of the output array is determined by the dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case, the output array will have the same depth as the input array, be it src1, src2 or both. Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow. depth is defined by dtype or src1/src2. output array to be changed. @sa subtract, addWeighted, scaleAdd, Mat::convertTo

Python prototype (for reference):

add(src1, src2[, dst[, mask[, dtype]]]) -> dst
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • mask: UMat.
  • dtype: int.

Calculates the per-element sum of two arrays or an array and a scalar. The function add calculates:

  • Sum of two arrays when both input arrays have the same size and the same number of channels: \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\f]
  • Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of elements as src1.channels(): \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) + \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\f]
  • Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of elements as src2.channels(): \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} + \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\f] where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. The first function in the list above can be replaced with matrix expressions:
    dst = src1 + src2;
    dst += src1; // equivalent to add(dst, src1, dst);
    The input arrays and the output array can all have the same or different depths. For example, you can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit floating-point array. Depth of the output array is determined by the dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case, the output array will have the same depth as the input array, be it src1, src2 or both. Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow. depth is defined by dtype or src1/src2. output array to be changed. @sa subtract, addWeighted, scaleAdd, Mat::convertTo

Python prototype (for reference):

add(src1, src2[, dst[, mask[, dtype]]]) -> dst
Link to this function

addText(img, text, org, nameFont)

View Source
Positional Arguments
  • img: Mat.
  • text: String.
  • org: Point.
  • nameFont: String.
Keyword Arguments
  • pointSize: int.
  • color: Scalar.
  • weight: int.
  • style: int.
  • spacing: int.

Draws a text on the image.

Times*). If the font is not found, a default one is used.
font is set to a system-dependent default value. Generally, this is 12 points.

Python prototype (for reference):

addText(img, text, org, nameFont[, pointSize[, color[, weight[, style[, spacing]]]]]) -> None
Link to this function

addText(img, text, org, nameFont, opts)

View Source
Positional Arguments
  • img: Mat.
  • text: String.
  • org: Point.
  • nameFont: String.
Keyword Arguments
  • pointSize: int.
  • color: Scalar.
  • weight: int.
  • style: int.
  • spacing: int.

Draws a text on the image.

Times*). If the font is not found, a default one is used.
font is set to a system-dependent default value. Generally, this is 12 points.

Python prototype (for reference):

addText(img, text, org, nameFont[, pointSize[, color[, weight[, style[, spacing]]]]]) -> None
Link to this function

addWeighted(src1, alpha, src2, beta, gamma)

View Source
Positional Arguments
  • src1: UMat.
  • alpha: double.
  • src2: UMat.
  • beta: double.
  • gamma: double.
Keyword Arguments
  • dst: UMat.
  • dtype: int.

Calculates the weighted sum of two arrays. The function addWeighted calculates the weighted sum of two arrays as follows: \f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} + \texttt{src2} (I)* \texttt{beta} + \texttt{gamma} )\f] where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. The function can be replaced with a matrix expression:

dst = src1*alpha + src2*beta + gamma;

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

can be set to -1, which will be equivalent to src1.depth().

@sa add, subtract, scaleAdd, Mat::convertTo

Python prototype (for reference):

addWeighted(src1, alpha, src2, beta, gamma[, dst[, dtype]]) -> dst
Link to this function

addWeighted(src1, alpha, src2, beta, gamma, opts)

View Source
Positional Arguments
  • src1: UMat.
  • alpha: double.
  • src2: UMat.
  • beta: double.
  • gamma: double.
Keyword Arguments
  • dst: UMat.
  • dtype: int.

Calculates the weighted sum of two arrays. The function addWeighted calculates the weighted sum of two arrays as follows: \f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} + \texttt{src2} (I)* \texttt{beta} + \texttt{gamma} )\f] where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. The function can be replaced with a matrix expression:

dst = src1*alpha + src2*beta + gamma;

Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

can be set to -1, which will be equivalent to src1.depth().

@sa add, subtract, scaleAdd, Mat::convertTo

Python prototype (for reference):

addWeighted(src1, alpha, src2, beta, gamma[, dst[, dtype]]) -> dst
Link to this function

applyColorMap(src, userColor)

View Source

Variaint 1:

Positional Arguments
  • src: UMat.
  • userColor: UMat.
Keyword Arguments
  • dst: UMat.

Applies a user colormap on a given image.

Python prototype (for reference):

applyColorMap(src, userColor[, dst]) -> dst

Variaint 2:

Positional Arguments
  • src: UMat.
  • colormap: int.
Keyword Arguments
  • dst: UMat.

Applies a GNU Octave/MATLAB equivalent colormap on a given image.

Python prototype (for reference):

applyColorMap(src, colormap[, dst]) -> dst
Link to this function

applyColorMap(src, userColor, opts)

View Source

Variaint 1:

Positional Arguments
  • src: UMat.
  • userColor: UMat.
Keyword Arguments
  • dst: UMat.

Applies a user colormap on a given image.

Python prototype (for reference):

applyColorMap(src, userColor[, dst]) -> dst

Variaint 2:

Positional Arguments
  • src: UMat.
  • colormap: int.
Keyword Arguments
  • dst: UMat.

Applies a GNU Octave/MATLAB equivalent colormap on a given image.

Python prototype (for reference):

applyColorMap(src, colormap[, dst]) -> dst
Link to this function

approxPolyDP(curve, epsilon, closed)

View Source
Positional Arguments
  • curve: UMat.
  • epsilon: double.
  • closed: bool.
Keyword Arguments
  • approxCurve: UMat.

Approximates a polygonal curve(s) with the specified precision. The function cv::approxPolyDP approximates a curve or a polygon with another curve/polygon with less vertices so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm

between the original curve and its approximation.
connected). Otherwise, it is not closed.

Python prototype (for reference):

approxPolyDP(curve, epsilon, closed[, approxCurve]) -> approxCurve
Link to this function

approxPolyDP(curve, epsilon, closed, opts)

View Source
Positional Arguments
  • curve: UMat.
  • epsilon: double.
  • closed: bool.
Keyword Arguments
  • approxCurve: UMat.

Approximates a polygonal curve(s) with the specified precision. The function cv::approxPolyDP approximates a curve or a polygon with another curve/polygon with less vertices so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm

between the original curve and its approximation.
connected). Otherwise, it is not closed.

Python prototype (for reference):

approxPolyDP(curve, epsilon, closed[, approxCurve]) -> approxCurve
Link to this function

arcLength(curve, closed)

View Source

Calculates a contour perimeter or a curve length. The function computes a curve length or a closed contour perimeter.

Python prototype (for reference):

arcLength(curve, closed) -> retval
Link to this function

arrowedLine(img, pt1, pt2, color)

View Source
Positional Arguments
  • img: UMat. Image.
  • pt1: Point.
  • pt2: Point.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • line_type: int.
  • shift: int.
  • tipLength: double.

Draws an arrow segment pointing from the first point to the second one. The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line.

Python prototype (for reference):

arrowedLine(img, pt1, pt2, color[, thickness[, line_type[, shift[, tipLength]]]]) -> img
Link to this function

arrowedLine(img, pt1, pt2, color, opts)

View Source
Positional Arguments
  • img: UMat. Image.
  • pt1: Point.
  • pt2: Point.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • line_type: int.
  • shift: int.
  • tipLength: double.

Draws an arrow segment pointing from the first point to the second one. The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line.

Python prototype (for reference):

arrowedLine(img, pt1, pt2, color[, thickness[, line_type[, shift[, tipLength]]]]) -> img
Link to this function

batchDistance(src1, src2, dtype)

View Source
Positional Arguments
  • src1: UMat
  • src2: UMat
  • dtype: int
Keyword Arguments
  • dist: UMat.
  • nidx: UMat.
  • normType: int.
  • k: int.
  • mask: UMat.
  • update: int.
  • crosscheck: bool.

naive nearest neighbor finder see http://en.wikipedia.org/wiki/Nearest_neighbor_search @todo document

Python prototype (for reference):

batchDistance(src1, src2, dtype[, dist[, nidx[, normType[, K[, mask[, update[, crosscheck]]]]]]]) -> dist, nidx
Link to this function

batchDistance(src1, src2, dtype, opts)

View Source
Positional Arguments
  • src1: UMat
  • src2: UMat
  • dtype: int
Keyword Arguments
  • dist: UMat.
  • nidx: UMat.
  • normType: int.
  • k: int.
  • mask: UMat.
  • update: int.
  • crosscheck: bool.

naive nearest neighbor finder see http://en.wikipedia.org/wiki/Nearest_neighbor_search @todo document

Python prototype (for reference):

batchDistance(src1, src2, dtype[, dist[, nidx[, normType[, K[, mask[, update[, crosscheck]]]]]]]) -> dist, nidx
Link to this function

bilateralFilter(src, d, sigmaColor, sigmaSpace)

View Source
Positional Arguments
  • src: UMat.
  • d: int.
  • sigmaColor: double.
  • sigmaSpace: double.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Applies the bilateral filter to an image. The function applies bilateral filtering to the input image, as described in http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is very slow compared to most filters. Sigma values: For simplicity, you can set the 2 sigma values to be the same. If they are small (\< 10), the filter will not have much effect, whereas if they are large (> 150), they will have a very strong effect, making the image look "cartoonish". Filter size: Large filters (d > 5) are very slow, so it is recommended to use d=5 for real-time applications, and perhaps d=9 for offline applications that need heavy noise filtering. This filter does not work inplace.

it is computed from sigmaSpace.
farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting
in larger areas of semi-equal color.
farther pixels will influence each other as long as their colors are close enough (see sigmaColor
). When d\>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is
proportional to sigmaSpace.

Python prototype (for reference):

bilateralFilter(src, d, sigmaColor, sigmaSpace[, dst[, borderType]]) -> dst
Link to this function

bilateralFilter(src, d, sigmaColor, sigmaSpace, opts)

View Source
Positional Arguments
  • src: UMat.
  • d: int.
  • sigmaColor: double.
  • sigmaSpace: double.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Applies the bilateral filter to an image. The function applies bilateral filtering to the input image, as described in http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is very slow compared to most filters. Sigma values: For simplicity, you can set the 2 sigma values to be the same. If they are small (\< 10), the filter will not have much effect, whereas if they are large (> 150), they will have a very strong effect, making the image look "cartoonish". Filter size: Large filters (d > 5) are very slow, so it is recommended to use d=5 for real-time applications, and perhaps d=9 for offline applications that need heavy noise filtering. This filter does not work inplace.

it is computed from sigmaSpace.
farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting
in larger areas of semi-equal color.
farther pixels will influence each other as long as their colors are close enough (see sigmaColor
). When d\>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is
proportional to sigmaSpace.

Python prototype (for reference):

bilateralFilter(src, d, sigmaColor, sigmaSpace[, dst[, borderType]]) -> dst
Link to this function

blendLinear(src1, src2, weights1, weights2)

View Source
Positional Arguments
  • src1: UMat
  • src2: UMat
  • weights1: UMat
  • weights2: UMat
Keyword Arguments
  • dst: UMat.

Has overloading in C++

variant without mask parameter

Python prototype (for reference):

blendLinear(src1, src2, weights1, weights2[, dst]) -> dst
Link to this function

blendLinear(src1, src2, weights1, weights2, opts)

View Source
Positional Arguments
  • src1: UMat
  • src2: UMat
  • weights1: UMat
  • weights2: UMat
Keyword Arguments
  • dst: UMat.

Has overloading in C++

variant without mask parameter

Python prototype (for reference):

blendLinear(src1, src2, weights1, weights2[, dst]) -> dst
Positional Arguments
  • src: UMat.
  • ksize: Size.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • borderType: int.

Blurs an image using the normalized box filter. The function smooths an image using the kernel: \f[\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \end{bmatrix}\f] The call blur(src, dst, ksize, anchor, borderType) is equivalent to boxFilter(src, dst, src.type(), ksize, anchor, true, borderType).

the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
center.

@sa boxFilter, bilateralFilter, GaussianBlur, medianBlur

Python prototype (for reference):

blur(src, ksize[, dst[, anchor[, borderType]]]) -> dst
Positional Arguments
  • src: UMat.
  • ksize: Size.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • borderType: int.

Blurs an image using the normalized box filter. The function smooths an image using the kernel: \f[\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \end{bmatrix}\f] The call blur(src, dst, ksize, anchor, borderType) is equivalent to boxFilter(src, dst, src.type(), ksize, anchor, true, borderType).

the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
center.

@sa boxFilter, bilateralFilter, GaussianBlur, medianBlur

Python prototype (for reference):

blur(src, ksize[, dst[, anchor[, borderType]]]) -> dst
Link to this function

borderInterpolate(p, len, borderType)

View Source

Computes the source location of an extrapolated pixel. The function computes and returns the coordinate of a donor pixel corresponding to the specified extrapolated pixel when using the specified extrapolation border mode. For example, if you use cv::BORDER_WRAP mode in the horizontal direction, cv::BORDER_REFLECT_101 in the vertical direction and want to compute value of the "virtual" pixel Point(-5, 100) in a floating-point image img , it looks like:

float val = img.at<float>(borderInterpolate(100, img.rows, cv::BORDER_REFLECT_101),
borderInterpolate(-5, img.cols, cv::BORDER_WRAP));

Normally, the function is not called directly. It is used inside filtering functions and also in copyMakeBorder.

#BORDER_ISOLATED . When borderType==#BORDER_CONSTANT , the function always returns -1, regardless
of p and len.

@sa copyMakeBorder

Python prototype (for reference):

borderInterpolate(p, len, borderType) -> retval

Calculates the up-right bounding rectangle of a point set or non-zero pixels of gray-scale image. The function calculates and returns the minimal up-right bounding rectangle for the specified point set or non-zero pixels of gray-scale image.

Python prototype (for reference):

boundingRect(array) -> retval
Link to this function

boxFilter(src, ddepth, ksize)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
  • ksize: Size.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • normalize: bool.
  • borderType: int.

Blurs an image using the box filter. The function smooths an image using the kernel: \f[\texttt{K} = \alpha \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \end{bmatrix}\f] where \f[\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} & \texttt{when } \texttt{normalize=true} \\1 & \texttt{otherwise}\end{cases}\f] Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on). If you need to compute pixel sums over variable-size windows, use #integral.

center.

@sa blur, bilateralFilter, GaussianBlur, medianBlur, integral

Python prototype (for reference):

boxFilter(src, ddepth, ksize[, dst[, anchor[, normalize[, borderType]]]]) -> dst
Link to this function

boxFilter(src, ddepth, ksize, opts)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
  • ksize: Size.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • normalize: bool.
  • borderType: int.

Blurs an image using the box filter. The function smooths an image using the kernel: \f[\texttt{K} = \alpha \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \end{bmatrix}\f] where \f[\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} & \texttt{when } \texttt{normalize=true} \\1 & \texttt{otherwise}\end{cases}\f] Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on). If you need to compute pixel sums over variable-size windows, use #integral.

center.

@sa blur, bilateralFilter, GaussianBlur, medianBlur, integral

Python prototype (for reference):

boxFilter(src, ddepth, ksize[, dst[, anchor[, normalize[, borderType]]]]) -> dst
Positional Arguments
  • box: RotatedRect.
Keyword Arguments
  • points: UMat.

Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle. The function finds the four vertices of a rotated rectangle. This function is useful to draw the rectangle. In C++, instead of using this function, you can directly use RotatedRect::points method. Please visit the @ref tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information.

Python prototype (for reference):

boxPoints(box[, points]) -> points
Positional Arguments
  • box: RotatedRect.
Keyword Arguments
  • points: UMat.

Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle. The function finds the four vertices of a rotated rectangle. This function is useful to draw the rectangle. In C++, instead of using this function, you can directly use RotatedRect::points method. Please visit the @ref tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information.

Python prototype (for reference):

boxPoints(box[, points]) -> points
Link to this function

buildOpticalFlowPyramid(img, winSize, maxLevel)

View Source
Positional Arguments
  • img: UMat.
  • winSize: Size.
  • maxLevel: int.
Keyword Arguments
  • pyramid: vector_UMat.
  • withDerivatives: bool.
  • pyrBorder: int.
  • derivBorder: int.
  • tryReuseInputImage: bool.

Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.

calcOpticalFlowPyrLK. It is needed to calculate required padding for pyramid levels.
constructed without the gradients then calcOpticalFlowPyrLK will calculate them internally.
to force data copying.

@return number of levels in constructed pyramid. Can be less than maxLevel.

Python prototype (for reference):

buildOpticalFlowPyramid(img, winSize, maxLevel[, pyramid[, withDerivatives[, pyrBorder[, derivBorder[, tryReuseInputImage]]]]]) -> retval, pyramid
Link to this function

buildOpticalFlowPyramid(img, winSize, maxLevel, opts)

View Source
Positional Arguments
  • img: UMat.
  • winSize: Size.
  • maxLevel: int.
Keyword Arguments
  • pyramid: vector_UMat.
  • withDerivatives: bool.
  • pyrBorder: int.
  • derivBorder: int.
  • tryReuseInputImage: bool.

Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.

calcOpticalFlowPyrLK. It is needed to calculate required padding for pyramid levels.
constructed without the gradients then calcOpticalFlowPyrLK will calculate them internally.
to force data copying.

@return number of levels in constructed pyramid. Can be less than maxLevel.

Python prototype (for reference):

buildOpticalFlowPyramid(img, winSize, maxLevel[, pyramid[, withDerivatives[, pyrBorder[, derivBorder[, tryReuseInputImage]]]]]) -> retval, pyramid
Link to this function

calcBackProject(images, channels, hist, ranges, scale)

View Source
Positional Arguments
  • images: vector_UMat
  • channels: vector_int
  • hist: UMat
  • ranges: vector_float
  • scale: double
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Python prototype (for reference):

calcBackProject(images, channels, hist, ranges, scale[, dst]) -> dst
Link to this function

calcBackProject(images, channels, hist, ranges, scale, opts)

View Source
Positional Arguments
  • images: vector_UMat
  • channels: vector_int
  • hist: UMat
  • ranges: vector_float
  • scale: double
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Python prototype (for reference):

calcBackProject(images, channels, hist, ranges, scale[, dst]) -> dst
Link to this function

calcCovarMatrix(samples, mean, flags)

View Source
Positional Arguments
  • samples: UMat.
  • mean: UMat.
  • flags: int.
Keyword Arguments
  • covar: UMat.
  • ctype: int.

Has overloading in C++

Note: use #COVAR_ROWS or #COVAR_COLS flag

Python prototype (for reference):

calcCovarMatrix(samples, mean, flags[, covar[, ctype]]) -> covar, mean
Link to this function

calcCovarMatrix(samples, mean, flags, opts)

View Source
Positional Arguments
  • samples: UMat.
  • mean: UMat.
  • flags: int.
Keyword Arguments
  • covar: UMat.
  • ctype: int.

Has overloading in C++

Note: use #COVAR_ROWS or #COVAR_COLS flag

Python prototype (for reference):

calcCovarMatrix(samples, mean, flags[, covar[, ctype]]) -> covar, mean
Link to this function

calcHist(images, channels, mask, histSize, ranges)

View Source
Positional Arguments
  • images: vector_UMat
  • channels: vector_int
  • mask: UMat
  • histSize: vector_int
  • ranges: vector_float
Keyword Arguments
  • hist: UMat.
  • accumulate: bool.

Has overloading in C++

Python prototype (for reference):

calcHist(images, channels, mask, histSize, ranges[, hist[, accumulate]]) -> hist
Link to this function

calcHist(images, channels, mask, histSize, ranges, opts)

View Source
Positional Arguments
  • images: vector_UMat
  • channels: vector_int
  • mask: UMat
  • histSize: vector_int
  • ranges: vector_float
Keyword Arguments
  • hist: UMat.
  • accumulate: bool.

Has overloading in C++

Python prototype (for reference):

calcHist(images, channels, mask, histSize, ranges[, hist[, accumulate]]) -> hist
Link to this function

calcOpticalFlowFarneback(prev, next, flow, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags)

View Source

Computes a dense optical flow using the Gunnar Farneback's algorithm.

pyr_scale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous
one.
layers are created and only the original images are used.
noise and give more chances for fast motion detection, but yield more blurred motion field.
larger values mean that the image will be approximated with smoother surfaces, yielding more
robust algorithm and more blurred motion field, typically poly_n =5 or 7.
basis for the polynomial expansion; for poly_n=5, you can set poly_sigma=1.1, for poly_n=7, a
good value would be poly_sigma=1.5.
-   **OPTFLOW_USE_INITIAL_FLOW** uses the input flow as an initial flow approximation.
-   **OPTFLOW_FARNEBACK_GAUSSIAN** uses the Gaussian \f$\texttt{winsize}\times\texttt{winsize}\f$
filter instead of a box filter of the same size for optical flow estimation; usually, this
option gives z more accurate flow than with a box filter, at the cost of lower speed;
normally, winsize for a Gaussian window should be set to a larger value to achieve the same
level of robustness.

The function finds an optical flow for each prev pixel using the @cite Farneback2003 algorithm so that \f[\texttt{prev} (y,x) \sim \texttt{next} ( y + \texttt{flow} (y,x)[1], x + \texttt{flow} (y,x)[0])\f] Note:

  • An example using the optical flow algorithm described by Gunnar Farneback can be found at opencv_source_code/samples/cpp/fback.cpp
  • (Python) An example using the optical flow algorithm described by Gunnar Farneback can be found at opencv_source_code/samples/python/opt_flow.py

Python prototype (for reference):

calcOpticalFlowFarneback(prev, next, flow, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags) -> flow
Link to this function

calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts)

View Source
Positional Arguments
  • prevImg: UMat.
  • nextImg: UMat.
  • prevPts: UMat.
  • nextPts: UMat.
Keyword Arguments
  • status: UMat.
  • err: UMat.
  • winSize: Size.
  • maxLevel: int.
  • criteria: TermCriteria.
  • flags: int.
  • minEigThreshold: double.

Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.

single-precision floating-point numbers.
containing the calculated new positions of input features in the second image; when
OPTFLOW_USE_INITIAL_FLOW flag is passed, the vector must have the same size as in the input.
the flow for the corresponding features has been found, otherwise, it is set to 0.
corresponding feature, type of the error measure can be set in flags parameter; if the flow wasn't
found then the error is not defined (use the status parameter to find such cases).
level), if set to 1, two levels are used, and so on; if pyramids are passed to input then
algorithm will use as many levels as pyramids have but no more than maxLevel.
(after the specified maximum number of iterations criteria.maxCount or when the search window
moves by less than criteria.epsilon.
-   **OPTFLOW_USE_INITIAL_FLOW** uses initial estimations, stored in nextPts; if the flag is
not set, then prevPts is copied to nextPts and is considered the initial estimate.
-   **OPTFLOW_LK_GET_MIN_EIGENVALS** use minimum eigen values as an error measure (see
minEigThreshold description); if the flag is not set, then L1 distance between patches
around the original and a moved point, divided by number of pixels in a window, is used as a
error measure.
optical flow equations (this matrix is called a spatial gradient matrix in @cite Bouguet00), divided
by number of pixels in a window; if this value is less than minEigThreshold, then a corresponding
feature is filtered out and its flow is not processed, so it allows to remove bad points and get a
performance boost.

The function implements a sparse iterative version of the Lucas-Kanade optical flow in pyramids. See @cite Bouguet00 . The function is parallelized with the TBB library. Note:

  • An example using the Lucas-Kanade optical flow algorithm can be found at opencv_source_code/samples/cpp/lkdemo.cpp
  • (Python) An example using the Lucas-Kanade optical flow algorithm can be found at opencv_source_code/samples/python/lk_track.py
  • (Python) An example using the Lucas-Kanade tracker for homography matching can be found at opencv_source_code/samples/python/lk_homography.py

Python prototype (for reference):

calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts[, status[, err[, winSize[, maxLevel[, criteria[, flags[, minEigThreshold]]]]]]]) -> nextPts, status, err
Link to this function

calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts, opts)

View Source
Positional Arguments
  • prevImg: UMat.
  • nextImg: UMat.
  • prevPts: UMat.
  • nextPts: UMat.
Keyword Arguments
  • status: UMat.
  • err: UMat.
  • winSize: Size.
  • maxLevel: int.
  • criteria: TermCriteria.
  • flags: int.
  • minEigThreshold: double.

Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.

single-precision floating-point numbers.
containing the calculated new positions of input features in the second image; when
OPTFLOW_USE_INITIAL_FLOW flag is passed, the vector must have the same size as in the input.
the flow for the corresponding features has been found, otherwise, it is set to 0.
corresponding feature, type of the error measure can be set in flags parameter; if the flow wasn't
found then the error is not defined (use the status parameter to find such cases).
level), if set to 1, two levels are used, and so on; if pyramids are passed to input then
algorithm will use as many levels as pyramids have but no more than maxLevel.
(after the specified maximum number of iterations criteria.maxCount or when the search window
moves by less than criteria.epsilon.
-   **OPTFLOW_USE_INITIAL_FLOW** uses initial estimations, stored in nextPts; if the flag is
not set, then prevPts is copied to nextPts and is considered the initial estimate.
-   **OPTFLOW_LK_GET_MIN_EIGENVALS** use minimum eigen values as an error measure (see
minEigThreshold description); if the flag is not set, then L1 distance between patches
around the original and a moved point, divided by number of pixels in a window, is used as a
error measure.
optical flow equations (this matrix is called a spatial gradient matrix in @cite Bouguet00), divided
by number of pixels in a window; if this value is less than minEigThreshold, then a corresponding
feature is filtered out and its flow is not processed, so it allows to remove bad points and get a
performance boost.

The function implements a sparse iterative version of the Lucas-Kanade optical flow in pyramids. See @cite Bouguet00 . The function is parallelized with the TBB library. Note:

  • An example using the Lucas-Kanade optical flow algorithm can be found at opencv_source_code/samples/cpp/lkdemo.cpp
  • (Python) An example using the Lucas-Kanade optical flow algorithm can be found at opencv_source_code/samples/python/lk_track.py
  • (Python) An example using the Lucas-Kanade tracker for homography matching can be found at opencv_source_code/samples/python/lk_homography.py

Python prototype (for reference):

calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts[, status[, err[, winSize[, maxLevel[, criteria[, flags[, minEigThreshold]]]]]]]) -> nextPts, status, err
Link to this function

calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs)

View Source
Positional Arguments
  • objectPoints: vector_UMat
  • imagePoints: vector_UMat
  • imageSize: Size
  • cameraMatrix: UMat
  • distCoeffs: UMat
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • flags: int.
  • criteria: TermCriteria.

Has overloading in C++

Python prototype (for reference):

calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs
Link to this function

calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, opts)

View Source
Positional Arguments
  • objectPoints: vector_UMat
  • imagePoints: vector_UMat
  • imageSize: Size
  • cameraMatrix: UMat
  • distCoeffs: UMat
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • flags: int.
  • criteria: TermCriteria.

Has overloading in C++

Python prototype (for reference):

calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs
Link to this function

calibrateCameraExtended(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs)

View Source
Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints: vector_UMat.
  • imageSize: Size.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • stdDeviationsIntrinsics: UMat.
  • stdDeviationsExtrinsics: UMat.
  • perViewErrors: UMat.
  • flags: int.
  • criteria: TermCriteria.

Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.

the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer
vector contains as many elements as the number of pattern views. If the same calibration pattern
is shown in each view and it is fully visible, all the vectors will be the same. Although, it is
possible to use partially occluded patterns or even different patterns in different views. Then,
the vectors will be different. Although the points are 3D, they all lie in the calibration pattern's
XY coordinate plane (thus 0 in the Z-coordinate), if the used calibration pattern is a planar rig.
In the old interface all the vectors of object points from different views are concatenated
together.
pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints.size() and
objectPoints.size(), and imagePoints[i].size() and objectPoints[i].size() for each i, must be equal,
respectively. In the old interface all the vectors of object points from different views are
concatenated together.
\f$\cameramatrix{A}\f$ . If @ref CALIB_USE_INTRINSIC_GUESS
and/or @ref CALIB_FIX_ASPECT_RATIO, @ref CALIB_FIX_PRINCIPAL_POINT or @ref CALIB_FIX_FOCAL_LENGTH
are specified, some or all of fx, fy, cx, cy must be initialized before calling the function.
\f$\distcoeffs\f$.
(e.g. std::vector<cv::Mat>>). That is, each i-th rotation vector together with the corresponding
i-th translation vector (see the next output parameter description) brings the calibration pattern
from the object coordinate space (in which object points are specified) to the camera coordinate
space. In more technical terms, the tuple of the i-th rotation and translation vector performs
a change of basis from object coordinate space to camera coordinate space. Due to its duality, this
tuple is equivalent to the position of the calibration pattern with respect to the camera coordinate
space.
describtion above.
parameters. Order of deviations values:
\f$(f\_x, f\_y, c\_x, c\_y, k\_1, k\_2, p\_1, p\_2, k\_3, k\_4, k\_5, k\_6 , s\_1, s\_2, s\_3,
s\_4, \tau\_x, \tau\_y)\f$ If one of parameters is not estimated, it's deviation is equals to zero.
parameters. Order of deviations values: \f$(R\_0, T\_0, \dotsc , R\_{M - 1}, T\_{M - 1})\f$ where M is
the number of pattern views. \f$R\_i, T\_i\f$ are concatenated 1x3 vectors.
-   @ref CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
center ( imageSize is used), and focal distances are computed in a least-squares fashion.
Note, that if intrinsic parameters are known, there is no need to use this function just to
estimate extrinsic parameters. Use @ref solvePnP instead.
-   @ref CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
optimization. It stays at the center or at a different location specified when

@ref CALIB_USE_INTRINSIC_GUESS is set too.

  • @ref CALIB_FIX_ASPECT_RATIO The functions consider only fy as a free parameter. The ratio fx/fy stays the same as in the input cameraMatrix . When @ref CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are ignored, only their ratio is computed and used further.
  • @ref CALIB_ZERO_TANGENT_DIST Tangential distortion coefficients \f$(p_1, p_2)\f$ are set to zeros and stay zero.
  • @ref CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global optimization if @ref CALIB_USE_INTRINSIC_GUESS is set.
  • @ref CALIB_FIX_K1,..., @ref CALIB_FIX_K6 The corresponding radial distortion coefficient is not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  • @ref CALIB_RATIONAL_MODEL Coefficients k4, k5, and k6 are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the rational model and return 8 coefficients or more.
  • @ref CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the thin prism model and return 12 coefficients or more.
  • @ref CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  • @ref CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the tilted sensor model and return 14 coefficients.
  • @ref CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0. @return the overall RMS re-projection error. The function estimates the intrinsic camera parameters and extrinsic parameters for each of the views. The algorithm is based on @cite Zhang2000 and @cite BouguetMCT . The coordinates of 3D object points and their corresponding 2D projections in each view must be specified. That may be achieved by using an object with known geometry and easily detectable feature points. Such an object is called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as a calibration rig (see @ref findChessboardCorners). Currently, initialization of intrinsic parameters (when @ref CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also be used as long as initial cameraMatrix is provided. The algorithm performs the following steps:
  • Compute the initial intrinsic parameters (the option only available for planar calibration patterns) or read them from the input parameters. The distortion coefficients are all set to zeros initially unless some of CALIB_FIX_K? are specified.
  • Estimate the initial camera pose as if the intrinsic parameters have been already known. This is done using @ref solvePnP .
  • Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error, that is, the total sum of squared distances between the observed feature points imagePoints and the projected (using the current estimates for camera parameters and the poses) object points objectPoints. See @ref projectPoints for details. Note: If you use a non-square (i.e. non-N-by-N) grid and @ref findChessboardCorners for calibration, and @ref calibrateCamera returns bad values (zero distortion coefficients, \f$c_x\f$ and \f$c_y\f$ very far from the image center, and/or large differences between \f$f_x\f$ and \f$f_y\f$ (ratios of 10:1 or more)), then you are probably using patternSize=cvSize(rows,cols) instead of using patternSize=cvSize(cols,rows) in @ref findChessboardCorners. @sa calibrateCameraRO, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort

Python prototype (for reference):

calibrateCameraExtended(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs[, rvecs[, tvecs[, stdDeviationsIntrinsics[, stdDeviationsExtrinsics[, perViewErrors[, flags[, criteria]]]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs, stdDeviationsIntrinsics, stdDeviationsExtrinsics, perViewErrors
Link to this function

calibrateCameraExtended(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, opts)

View Source
Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints: vector_UMat.
  • imageSize: Size.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • stdDeviationsIntrinsics: UMat.
  • stdDeviationsExtrinsics: UMat.
  • perViewErrors: UMat.
  • flags: int.
  • criteria: TermCriteria.

Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.

the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer
vector contains as many elements as the number of pattern views. If the same calibration pattern
is shown in each view and it is fully visible, all the vectors will be the same. Although, it is
possible to use partially occluded patterns or even different patterns in different views. Then,
the vectors will be different. Although the points are 3D, they all lie in the calibration pattern's
XY coordinate plane (thus 0 in the Z-coordinate), if the used calibration pattern is a planar rig.
In the old interface all the vectors of object points from different views are concatenated
together.
pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints.size() and
objectPoints.size(), and imagePoints[i].size() and objectPoints[i].size() for each i, must be equal,
respectively. In the old interface all the vectors of object points from different views are
concatenated together.
\f$\cameramatrix{A}\f$ . If @ref CALIB_USE_INTRINSIC_GUESS
and/or @ref CALIB_FIX_ASPECT_RATIO, @ref CALIB_FIX_PRINCIPAL_POINT or @ref CALIB_FIX_FOCAL_LENGTH
are specified, some or all of fx, fy, cx, cy must be initialized before calling the function.
\f$\distcoeffs\f$.
(e.g. std::vector<cv::Mat>>). That is, each i-th rotation vector together with the corresponding
i-th translation vector (see the next output parameter description) brings the calibration pattern
from the object coordinate space (in which object points are specified) to the camera coordinate
space. In more technical terms, the tuple of the i-th rotation and translation vector performs
a change of basis from object coordinate space to camera coordinate space. Due to its duality, this
tuple is equivalent to the position of the calibration pattern with respect to the camera coordinate
space.
describtion above.
parameters. Order of deviations values:
\f$(f\_x, f\_y, c\_x, c\_y, k\_1, k\_2, p\_1, p\_2, k\_3, k\_4, k\_5, k\_6 , s\_1, s\_2, s\_3,
s\_4, \tau\_x, \tau\_y)\f$ If one of parameters is not estimated, it's deviation is equals to zero.
parameters. Order of deviations values: \f$(R\_0, T\_0, \dotsc , R\_{M - 1}, T\_{M - 1})\f$ where M is
the number of pattern views. \f$R\_i, T\_i\f$ are concatenated 1x3 vectors.
-   @ref CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
center ( imageSize is used), and focal distances are computed in a least-squares fashion.
Note, that if intrinsic parameters are known, there is no need to use this function just to
estimate extrinsic parameters. Use @ref solvePnP instead.
-   @ref CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
optimization. It stays at the center or at a different location specified when

@ref CALIB_USE_INTRINSIC_GUESS is set too.

  • @ref CALIB_FIX_ASPECT_RATIO The functions consider only fy as a free parameter. The ratio fx/fy stays the same as in the input cameraMatrix . When @ref CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are ignored, only their ratio is computed and used further.
  • @ref CALIB_ZERO_TANGENT_DIST Tangential distortion coefficients \f$(p_1, p_2)\f$ are set to zeros and stay zero.
  • @ref CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global optimization if @ref CALIB_USE_INTRINSIC_GUESS is set.
  • @ref CALIB_FIX_K1,..., @ref CALIB_FIX_K6 The corresponding radial distortion coefficient is not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  • @ref CALIB_RATIONAL_MODEL Coefficients k4, k5, and k6 are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the rational model and return 8 coefficients or more.
  • @ref CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the thin prism model and return 12 coefficients or more.
  • @ref CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  • @ref CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the tilted sensor model and return 14 coefficients.
  • @ref CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0. @return the overall RMS re-projection error. The function estimates the intrinsic camera parameters and extrinsic parameters for each of the views. The algorithm is based on @cite Zhang2000 and @cite BouguetMCT . The coordinates of 3D object points and their corresponding 2D projections in each view must be specified. That may be achieved by using an object with known geometry and easily detectable feature points. Such an object is called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as a calibration rig (see @ref findChessboardCorners). Currently, initialization of intrinsic parameters (when @ref CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also be used as long as initial cameraMatrix is provided. The algorithm performs the following steps:
  • Compute the initial intrinsic parameters (the option only available for planar calibration patterns) or read them from the input parameters. The distortion coefficients are all set to zeros initially unless some of CALIB_FIX_K? are specified.
  • Estimate the initial camera pose as if the intrinsic parameters have been already known. This is done using @ref solvePnP .
  • Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error, that is, the total sum of squared distances between the observed feature points imagePoints and the projected (using the current estimates for camera parameters and the poses) object points objectPoints. See @ref projectPoints for details. Note: If you use a non-square (i.e. non-N-by-N) grid and @ref findChessboardCorners for calibration, and @ref calibrateCamera returns bad values (zero distortion coefficients, \f$c_x\f$ and \f$c_y\f$ very far from the image center, and/or large differences between \f$f_x\f$ and \f$f_y\f$ (ratios of 10:1 or more)), then you are probably using patternSize=cvSize(rows,cols) instead of using patternSize=cvSize(cols,rows) in @ref findChessboardCorners. @sa calibrateCameraRO, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort

Python prototype (for reference):

calibrateCameraExtended(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs[, rvecs[, tvecs[, stdDeviationsIntrinsics[, stdDeviationsExtrinsics[, perViewErrors[, flags[, criteria]]]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs, stdDeviationsIntrinsics, stdDeviationsExtrinsics, perViewErrors
Link to this function

calibrateCameraRO(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs)

View Source
Positional Arguments
  • objectPoints: vector_UMat
  • imagePoints: vector_UMat
  • imageSize: Size
  • iFixedPoint: int
  • cameraMatrix: UMat
  • distCoeffs: UMat
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • newObjPoints: UMat.
  • flags: int.
  • criteria: TermCriteria.

Has overloading in C++

Python prototype (for reference):

calibrateCameraRO(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs[, rvecs[, tvecs[, newObjPoints[, flags[, criteria]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs, newObjPoints
Link to this function

calibrateCameraRO(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs, opts)

View Source
Positional Arguments
  • objectPoints: vector_UMat
  • imagePoints: vector_UMat
  • imageSize: Size
  • iFixedPoint: int
  • cameraMatrix: UMat
  • distCoeffs: UMat
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • newObjPoints: UMat.
  • flags: int.
  • criteria: TermCriteria.

Has overloading in C++

Python prototype (for reference):

calibrateCameraRO(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs[, rvecs[, tvecs[, newObjPoints[, flags[, criteria]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs, newObjPoints
Link to this function

calibrateCameraROExtended(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs)

View Source
Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints: vector_UMat.
  • imageSize: Size.
  • iFixedPoint: int.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • newObjPoints: UMat.
  • stdDeviationsIntrinsics: UMat.
  • stdDeviationsExtrinsics: UMat.
  • stdDeviationsObjPoints: UMat.
  • perViewErrors: UMat.
  • flags: int.
  • criteria: TermCriteria.

Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern. This function is an extension of #calibrateCamera with the method of releasing object which was proposed in @cite strobl2011iccv. In many common cases with inaccurate, unmeasured, roughly planar targets (calibration plates), this method can dramatically improve the precision of the estimated camera parameters. Both the object-releasing method and standard method are supported by this function. Use the parameter iFixedPoint for method selection. In the internal implementation, #calibrateCamera is a wrapper for this function.

coordinate space. See #calibrateCamera for details. If the method of releasing object to be used,
the identical calibration board must be used in each view and it must be fully visible, and all
objectPoints[i] must be the same and all points should be roughly close to a plane. **The calibration
target has to be rigid, or at least static if the camera (rather than the calibration target) is
shifted for grabbing images.**
#calibrateCamera for details.
a switch for calibration method selection. If object-releasing method to be used, pass in the
parameter in the range of [1, objectPoints[0].size()-2], otherwise a value out of this range will
make standard calibration method selected. Usually the top-right corner point of the calibration
board grid is recommended to be fixed when object-releasing method being utilized. According to
\cite strobl2011iccv, two other points are also fixed. In this implementation, objectPoints[0].front
and objectPoints[0].back.z are used. With object-releasing method, accurate rvecs, tvecs and
newObjPoints are only possible if coordinates of these three fixed points are accurate enough.
for details.
be scaled based on three fixed points. The returned coordinates are accurate only if the above
mentioned three fixed points are accurate. If not needed, noArray() can be passed in. This parameter
is ignored with standard calibration method.
See #calibrateCamera for details.
See #calibrateCamera for details.
of calibration pattern points. It has the same size and order as objectPoints[0] vector. This
parameter is ignored with standard calibration method.
#calibrateCamera for details. If the method of releasing object is used, the calibration time may
be much longer. CALIB_USE_QR or CALIB_USE_LU could be used for faster calibration with potentially
less precise and less stable in some rare cases.

@return the overall RMS re-projection error. The function estimates the intrinsic camera parameters and extrinsic parameters for each of the views. The algorithm is based on @cite Zhang2000, @cite BouguetMCT and @cite strobl2011iccv. See #calibrateCamera for other detailed explanations. @sa calibrateCamera, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort

Python prototype (for reference):

calibrateCameraROExtended(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs[, rvecs[, tvecs[, newObjPoints[, stdDeviationsIntrinsics[, stdDeviationsExtrinsics[, stdDeviationsObjPoints[, perViewErrors[, flags[, criteria]]]]]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs, newObjPoints, stdDeviationsIntrinsics, stdDeviationsExtrinsics, stdDeviationsObjPoints, perViewErrors
Link to this function

calibrateCameraROExtended(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs, opts)

View Source
Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints: vector_UMat.
  • imageSize: Size.
  • iFixedPoint: int.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • newObjPoints: UMat.
  • stdDeviationsIntrinsics: UMat.
  • stdDeviationsExtrinsics: UMat.
  • stdDeviationsObjPoints: UMat.
  • perViewErrors: UMat.
  • flags: int.
  • criteria: TermCriteria.

Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern. This function is an extension of #calibrateCamera with the method of releasing object which was proposed in @cite strobl2011iccv. In many common cases with inaccurate, unmeasured, roughly planar targets (calibration plates), this method can dramatically improve the precision of the estimated camera parameters. Both the object-releasing method and standard method are supported by this function. Use the parameter iFixedPoint for method selection. In the internal implementation, #calibrateCamera is a wrapper for this function.

coordinate space. See #calibrateCamera for details. If the method of releasing object to be used,
the identical calibration board must be used in each view and it must be fully visible, and all
objectPoints[i] must be the same and all points should be roughly close to a plane. **The calibration
target has to be rigid, or at least static if the camera (rather than the calibration target) is
shifted for grabbing images.**
#calibrateCamera for details.
a switch for calibration method selection. If object-releasing method to be used, pass in the
parameter in the range of [1, objectPoints[0].size()-2], otherwise a value out of this range will
make standard calibration method selected. Usually the top-right corner point of the calibration
board grid is recommended to be fixed when object-releasing method being utilized. According to
\cite strobl2011iccv, two other points are also fixed. In this implementation, objectPoints[0].front
and objectPoints[0].back.z are used. With object-releasing method, accurate rvecs, tvecs and
newObjPoints are only possible if coordinates of these three fixed points are accurate enough.
for details.
be scaled based on three fixed points. The returned coordinates are accurate only if the above
mentioned three fixed points are accurate. If not needed, noArray() can be passed in. This parameter
is ignored with standard calibration method.
See #calibrateCamera for details.
See #calibrateCamera for details.
of calibration pattern points. It has the same size and order as objectPoints[0] vector. This
parameter is ignored with standard calibration method.
#calibrateCamera for details. If the method of releasing object is used, the calibration time may
be much longer. CALIB_USE_QR or CALIB_USE_LU could be used for faster calibration with potentially
less precise and less stable in some rare cases.

@return the overall RMS re-projection error. The function estimates the intrinsic camera parameters and extrinsic parameters for each of the views. The algorithm is based on @cite Zhang2000, @cite BouguetMCT and @cite strobl2011iccv. See #calibrateCamera for other detailed explanations. @sa calibrateCamera, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort

Python prototype (for reference):

calibrateCameraROExtended(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs[, rvecs[, tvecs[, newObjPoints[, stdDeviationsIntrinsics[, stdDeviationsExtrinsics[, stdDeviationsObjPoints[, perViewErrors[, flags[, criteria]]]]]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs, newObjPoints, stdDeviationsIntrinsics, stdDeviationsExtrinsics, stdDeviationsObjPoints, perViewErrors
Link to this function

calibrateHandEye(r_gripper2base, t_gripper2base, r_target2cam, t_target2cam)

View Source
Positional Arguments
  • r_gripper2base: vector_UMat.
  • t_gripper2base: vector_UMat.
  • r_target2cam: vector_UMat.
  • t_target2cam: vector_UMat.
Keyword Arguments
  • r_cam2gripper: UMat.
  • t_cam2gripper: UMat.
  • method: HandEyeCalibrationMethod.

Computes Hand-Eye calibration: \f$_{}^{g}\textrm{T}_c\f$

expressed in the gripper frame to the robot base frame (\f$\_{}^{b}\textrm{T}\_g\f$).
This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
for all the transformations from gripper frame to robot base frame.
expressed in the gripper frame to the robot base frame (\f$\_{}^{b}\textrm{T}\_g\f$).
This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
from gripper frame to robot base frame.
expressed in the target frame to the camera frame (\f$\_{}^{c}\textrm{T}\_t\f$).
This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
for all the transformations from calibration target frame to camera frame.
expressed in the target frame to the camera frame (\f$\_{}^{c}\textrm{T}\_t\f$).
This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
from calibration target frame to camera frame.
expressed in the camera frame to the gripper frame (\f$\_{}^{g}\textrm{T}\_c\f$).
expressed in the camera frame to the gripper frame (\f$\_{}^{g}\textrm{T}\_c\f$).

The function performs the Hand-Eye calibration using various methods. One approach consists in estimating the rotation then the translation (separable solutions) and the following methods are implemented:

  • R. Tsai, R. Lenz A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/EyeCalibration \cite Tsai89
  • F. Park, B. Martin Robot Sensor Calibration: Solving AX = XB on the Euclidean Group \cite Park94
  • R. Horaud, F. Dornaika Hand-Eye Calibration \cite Horaud95 Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions), with the following implemented methods:
  • N. Andreff, R. Horaud, B. Espiau On-line Hand-Eye Calibration \cite Andreff99
  • K. Daniilidis Hand-Eye Calibration Using Dual Quaternions \cite Daniilidis98 The following picture describes the Hand-Eye calibration problem where the transformation between a camera ("eye") mounted on a robot gripper ("hand") has to be estimated. This configuration is called eye-in-hand. The eye-to-hand configuration consists in a static camera observing a calibration pattern mounted on the robot end-effector. The transformation from the camera to the robot base frame can then be estimated by inputting the suitable transformations to the function, see below. The calibration procedure is the following:
  • a static calibration pattern is used to estimate the transformation between the target frame and the camera frame
  • the robot gripper is moved in order to acquire several poses
  • for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for instance the robot kinematics \f[ \begin{bmatrix} X_b\\ Y_b\\ Z_b\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{b}\textrm{R}_g & _{}^{b}\textrm{t}_g \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \f]
  • for each pose, the homogeneous transformation between the calibration target frame and the camera frame is recorded using for instance a pose estimation method (PnP) from 2D-3D point correspondences \f[ \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{c}\textrm{R}_t & _{}^{c}\textrm{t}_t \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_t\\ Y_t\\ Z_t\\ 1 \end{bmatrix} \f] The Hand-Eye calibration procedure returns the following homogeneous transformation \f[ \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{g}\textrm{R}_c & _{}^{g}\textrm{t}_c \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix} \f] This problem is also known as solving the \f$\mathbf{A}\mathbf{X}=\mathbf{X}\mathbf{B}\f$ equation:
  • for an eye-in-hand configuration \f[ \begin{align*} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &= \hspace{0.1em} ^{b}{\textrm{T}_g}^{(2)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\ (^{b}{\textrm{T}_g}^{(2)})^{-1} \hspace{0.2em} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c &= \hspace{0.1em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\ \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\ \end{align*} \f]
  • for an eye-to-hand configuration \f[ \begin{align*} ^{g}{\textrm{T}_b}^{(1)} \hspace{0.2em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &= \hspace{0.1em} ^{g}{\textrm{T}_b}^{(2)} \hspace{0.2em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\ (^{g}{\textrm{T}_b}^{(2)})^{-1} \hspace{0.2em} ^{g}{\textrm{T}_b}^{(1)} \hspace{0.2em} ^{b}\textrm{T}_c &= \hspace{0.1em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\ \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\ \end{align*} \f] \note Additional information can be found on this website. \note A minimum of 2 motions with non parallel rotation axes are necessary to determine the hand-eye transformation. So at least 3 different poses are required, but it is strongly recommended to use many more poses.

Python prototype (for reference):

calibrateHandEye(R_gripper2base, t_gripper2base, R_target2cam, t_target2cam[, R_cam2gripper[, t_cam2gripper[, method]]]) -> R_cam2gripper, t_cam2gripper
Link to this function

calibrateHandEye(r_gripper2base, t_gripper2base, r_target2cam, t_target2cam, opts)

View Source
Positional Arguments
  • r_gripper2base: vector_UMat.
  • t_gripper2base: vector_UMat.
  • r_target2cam: vector_UMat.
  • t_target2cam: vector_UMat.
Keyword Arguments
  • r_cam2gripper: UMat.
  • t_cam2gripper: UMat.
  • method: HandEyeCalibrationMethod.

Computes Hand-Eye calibration: \f$_{}^{g}\textrm{T}_c\f$

expressed in the gripper frame to the robot base frame (\f$\_{}^{b}\textrm{T}\_g\f$).
This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
for all the transformations from gripper frame to robot base frame.
expressed in the gripper frame to the robot base frame (\f$\_{}^{b}\textrm{T}\_g\f$).
This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
from gripper frame to robot base frame.
expressed in the target frame to the camera frame (\f$\_{}^{c}\textrm{T}\_t\f$).
This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
for all the transformations from calibration target frame to camera frame.
expressed in the target frame to the camera frame (\f$\_{}^{c}\textrm{T}\_t\f$).
This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
from calibration target frame to camera frame.
expressed in the camera frame to the gripper frame (\f$\_{}^{g}\textrm{T}\_c\f$).
expressed in the camera frame to the gripper frame (\f$\_{}^{g}\textrm{T}\_c\f$).

The function performs the Hand-Eye calibration using various methods. One approach consists in estimating the rotation then the translation (separable solutions) and the following methods are implemented:

  • R. Tsai, R. Lenz A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/EyeCalibration \cite Tsai89
  • F. Park, B. Martin Robot Sensor Calibration: Solving AX = XB on the Euclidean Group \cite Park94
  • R. Horaud, F. Dornaika Hand-Eye Calibration \cite Horaud95 Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions), with the following implemented methods:
  • N. Andreff, R. Horaud, B. Espiau On-line Hand-Eye Calibration \cite Andreff99
  • K. Daniilidis Hand-Eye Calibration Using Dual Quaternions \cite Daniilidis98 The following picture describes the Hand-Eye calibration problem where the transformation between a camera ("eye") mounted on a robot gripper ("hand") has to be estimated. This configuration is called eye-in-hand. The eye-to-hand configuration consists in a static camera observing a calibration pattern mounted on the robot end-effector. The transformation from the camera to the robot base frame can then be estimated by inputting the suitable transformations to the function, see below. The calibration procedure is the following:
  • a static calibration pattern is used to estimate the transformation between the target frame and the camera frame
  • the robot gripper is moved in order to acquire several poses
  • for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for instance the robot kinematics \f[ \begin{bmatrix} X_b\\ Y_b\\ Z_b\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{b}\textrm{R}_g & _{}^{b}\textrm{t}_g \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \f]
  • for each pose, the homogeneous transformation between the calibration target frame and the camera frame is recorded using for instance a pose estimation method (PnP) from 2D-3D point correspondences \f[ \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{c}\textrm{R}_t & _{}^{c}\textrm{t}_t \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_t\\ Y_t\\ Z_t\\ 1 \end{bmatrix} \f] The Hand-Eye calibration procedure returns the following homogeneous transformation \f[ \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{g}\textrm{R}_c & _{}^{g}\textrm{t}_c \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix} \f] This problem is also known as solving the \f$\mathbf{A}\mathbf{X}=\mathbf{X}\mathbf{B}\f$ equation:
  • for an eye-in-hand configuration \f[ \begin{align*} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &= \hspace{0.1em} ^{b}{\textrm{T}_g}^{(2)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\ (^{b}{\textrm{T}_g}^{(2)})^{-1} \hspace{0.2em} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c &= \hspace{0.1em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\ \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\ \end{align*} \f]
  • for an eye-to-hand configuration \f[ \begin{align*} ^{g}{\textrm{T}_b}^{(1)} \hspace{0.2em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &= \hspace{0.1em} ^{g}{\textrm{T}_b}^{(2)} \hspace{0.2em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\ (^{g}{\textrm{T}_b}^{(2)})^{-1} \hspace{0.2em} ^{g}{\textrm{T}_b}^{(1)} \hspace{0.2em} ^{b}\textrm{T}_c &= \hspace{0.1em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\ \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\ \end{align*} \f] \note Additional information can be found on this website. \note A minimum of 2 motions with non parallel rotation axes are necessary to determine the hand-eye transformation. So at least 3 different poses are required, but it is strongly recommended to use many more poses.

Python prototype (for reference):

calibrateHandEye(R_gripper2base, t_gripper2base, R_target2cam, t_target2cam[, R_cam2gripper[, t_cam2gripper[, method]]]) -> R_cam2gripper, t_cam2gripper
Link to this function

calibrateRobotWorldHandEye(r_world2cam, t_world2cam, r_base2gripper, t_base2gripper)

View Source
Positional Arguments
  • r_world2cam: vector_UMat.
  • t_world2cam: vector_UMat.
  • r_base2gripper: vector_UMat.
  • t_base2gripper: vector_UMat.
Keyword Arguments
  • r_base2world: UMat.
  • t_base2world: UMat.
  • r_gripper2cam: UMat.
  • t_gripper2cam: UMat.
  • method: RobotWorldHandEyeCalibrationMethod.

Computes Robot-World/Hand-Eye calibration: \f$_{}^{w}\textrm{T}_b\f$ and \f$_{}^{c}\textrm{T}_g\f$

expressed in the world frame to the camera frame (\f$\_{}^{c}\textrm{T}\_w\f$).
This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
for all the transformations from world frame to the camera frame.
expressed in the world frame to the camera frame (\f$\_{}^{c}\textrm{T}\_w\f$).
This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
from world frame to the camera frame.
expressed in the robot base frame to the gripper frame (\f$\_{}^{g}\textrm{T}\_b\f$).
This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
for all the transformations from robot base frame to the gripper frame.
expressed in the robot base frame to the gripper frame (\f$\_{}^{g}\textrm{T}\_b\f$).
This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
from robot base frame to the gripper frame.
expressed in the robot base frame to the world frame (\f$\_{}^{w}\textrm{T}\_b\f$).
expressed in the robot base frame to the world frame (\f$\_{}^{w}\textrm{T}\_b\f$).
expressed in the gripper frame to the camera frame (\f$\_{}^{c}\textrm{T}\_g\f$).
expressed in the gripper frame to the camera frame (\f$\_{}^{c}\textrm{T}\_g\f$).

The function performs the Robot-World/Hand-Eye calibration using various methods. One approach consists in estimating the rotation then the translation (separable solutions):

  • M. Shah, Solving the robot-world/hand-eye calibration problem using the kronecker product \cite Shah2013SolvingTR Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions), with the following implemented method:
  • A. Li, L. Wang, and D. Wu, Simultaneous robot-world and hand-eye calibration using dual-quaternions and kronecker product \cite Li2010SimultaneousRA The following picture describes the Robot-World/Hand-Eye calibration problem where the transformations between a robot and a world frame and between a robot gripper ("hand") and a camera ("eye") mounted at the robot end-effector have to be estimated. The calibration procedure is the following:
  • a static calibration pattern is used to estimate the transformation between the target frame and the camera frame
  • the robot gripper is moved in order to acquire several poses
  • for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for instance the robot kinematics \f[ \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{g}\textrm{R}_b & _{}^{g}\textrm{t}_b \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_b\\ Y_b\\ Z_b\\ 1 \end{bmatrix} \f]
  • for each pose, the homogeneous transformation between the calibration target frame (the world frame) and the camera frame is recorded using for instance a pose estimation method (PnP) from 2D-3D point correspondences \f[ \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{c}\textrm{R}_w & _{}^{c}\textrm{t}_w \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_w\\ Y_w\\ Z_w\\ 1 \end{bmatrix} \f] The Robot-World/Hand-Eye calibration procedure returns the following homogeneous transformations \f[ \begin{bmatrix} X_w\\ Y_w\\ Z_w\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{w}\textrm{R}_b & _{}^{w}\textrm{t}_b \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_b\\ Y_b\\ Z_b\\ 1 \end{bmatrix} \f] \f[ \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{c}\textrm{R}_g & _{}^{c}\textrm{t}_g \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \f] This problem is also known as solving the \f$\mathbf{A}\mathbf{X}=\mathbf{Z}\mathbf{B}\f$ equation, with:
  • \f$\mathbf{A} \Leftrightarrow \hspace{0.1em} _{}^{c}\textrm{T}_w\f$
  • \f$\mathbf{X} \Leftrightarrow \hspace{0.1em} _{}^{w}\textrm{T}_b\f$
  • \f$\mathbf{Z} \Leftrightarrow \hspace{0.1em} _{}^{c}\textrm{T}_g\f$
  • \f$\mathbf{B} \Leftrightarrow \hspace{0.1em} _{}^{g}\textrm{T}_b\f$ \note At least 3 measurements are required (input vectors size must be greater or equal to 3).

Python prototype (for reference):

calibrateRobotWorldHandEye(R_world2cam, t_world2cam, R_base2gripper, t_base2gripper[, R_base2world[, t_base2world[, R_gripper2cam[, t_gripper2cam[, method]]]]]) -> R_base2world, t_base2world, R_gripper2cam, t_gripper2cam
Link to this function

calibrateRobotWorldHandEye(r_world2cam, t_world2cam, r_base2gripper, t_base2gripper, opts)

View Source
Positional Arguments
  • r_world2cam: vector_UMat.
  • t_world2cam: vector_UMat.
  • r_base2gripper: vector_UMat.
  • t_base2gripper: vector_UMat.
Keyword Arguments
  • r_base2world: UMat.
  • t_base2world: UMat.
  • r_gripper2cam: UMat.
  • t_gripper2cam: UMat.
  • method: RobotWorldHandEyeCalibrationMethod.

Computes Robot-World/Hand-Eye calibration: \f$_{}^{w}\textrm{T}_b\f$ and \f$_{}^{c}\textrm{T}_g\f$

expressed in the world frame to the camera frame (\f$\_{}^{c}\textrm{T}\_w\f$).
This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
for all the transformations from world frame to the camera frame.
expressed in the world frame to the camera frame (\f$\_{}^{c}\textrm{T}\_w\f$).
This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
from world frame to the camera frame.
expressed in the robot base frame to the gripper frame (\f$\_{}^{g}\textrm{T}\_b\f$).
This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
for all the transformations from robot base frame to the gripper frame.
expressed in the robot base frame to the gripper frame (\f$\_{}^{g}\textrm{T}\_b\f$).
This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
from robot base frame to the gripper frame.
expressed in the robot base frame to the world frame (\f$\_{}^{w}\textrm{T}\_b\f$).
expressed in the robot base frame to the world frame (\f$\_{}^{w}\textrm{T}\_b\f$).
expressed in the gripper frame to the camera frame (\f$\_{}^{c}\textrm{T}\_g\f$).
expressed in the gripper frame to the camera frame (\f$\_{}^{c}\textrm{T}\_g\f$).

The function performs the Robot-World/Hand-Eye calibration using various methods. One approach consists in estimating the rotation then the translation (separable solutions):

  • M. Shah, Solving the robot-world/hand-eye calibration problem using the kronecker product \cite Shah2013SolvingTR Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions), with the following implemented method:
  • A. Li, L. Wang, and D. Wu, Simultaneous robot-world and hand-eye calibration using dual-quaternions and kronecker product \cite Li2010SimultaneousRA The following picture describes the Robot-World/Hand-Eye calibration problem where the transformations between a robot and a world frame and between a robot gripper ("hand") and a camera ("eye") mounted at the robot end-effector have to be estimated. The calibration procedure is the following:
  • a static calibration pattern is used to estimate the transformation between the target frame and the camera frame
  • the robot gripper is moved in order to acquire several poses
  • for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for instance the robot kinematics \f[ \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{g}\textrm{R}_b & _{}^{g}\textrm{t}_b \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_b\\ Y_b\\ Z_b\\ 1 \end{bmatrix} \f]
  • for each pose, the homogeneous transformation between the calibration target frame (the world frame) and the camera frame is recorded using for instance a pose estimation method (PnP) from 2D-3D point correspondences \f[ \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{c}\textrm{R}_w & _{}^{c}\textrm{t}_w \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_w\\ Y_w\\ Z_w\\ 1 \end{bmatrix} \f] The Robot-World/Hand-Eye calibration procedure returns the following homogeneous transformations \f[ \begin{bmatrix} X_w\\ Y_w\\ Z_w\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{w}\textrm{R}_b & _{}^{w}\textrm{t}_b \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_b\\ Y_b\\ Z_b\\ 1 \end{bmatrix} \f] \f[ \begin{bmatrix} X_c\\ Y_c\\ Z_c\\ 1 \end{bmatrix} \begin{bmatrix} _{}^{c}\textrm{R}_g & _{}^{c}\textrm{t}_g \\ 0_{1 \times 3} & 1 \end{bmatrix} \begin{bmatrix} X_g\\ Y_g\\ Z_g\\ 1 \end{bmatrix} \f] This problem is also known as solving the \f$\mathbf{A}\mathbf{X}=\mathbf{Z}\mathbf{B}\f$ equation, with:
  • \f$\mathbf{A} \Leftrightarrow \hspace{0.1em} _{}^{c}\textrm{T}_w\f$
  • \f$\mathbf{X} \Leftrightarrow \hspace{0.1em} _{}^{w}\textrm{T}_b\f$
  • \f$\mathbf{Z} \Leftrightarrow \hspace{0.1em} _{}^{c}\textrm{T}_g\f$
  • \f$\mathbf{B} \Leftrightarrow \hspace{0.1em} _{}^{g}\textrm{T}_b\f$ \note At least 3 measurements are required (input vectors size must be greater or equal to 3).

Python prototype (for reference):

calibrateRobotWorldHandEye(R_world2cam, t_world2cam, R_base2gripper, t_base2gripper[, R_base2world[, t_base2world[, R_gripper2cam[, t_gripper2cam[, method]]]]]) -> R_base2world, t_base2world, R_gripper2cam, t_gripper2cam
Link to this function

calibrationMatrixValues(cameraMatrix, imageSize, apertureWidth, apertureHeight)

View Source

Computes useful camera characteristics from the camera intrinsic matrix.

#stereoCalibrate .

The function computes various useful camera characteristics from the previously estimated camera matrix. Note: Do keep in mind that the unity measure 'mm' stands for whatever unit of measure one chooses for the chessboard pitch (it can thus be any value).

Python prototype (for reference):

calibrationMatrixValues(cameraMatrix, imageSize, apertureWidth, apertureHeight) -> fovx, fovy, focalLength, principalPoint, aspectRatio
Link to this function

camShift(probImage, window, criteria)

View Source

Finds an object center, size, and orientation.

returns
(in old interfaces) Number of iterations CAMSHIFT took to converge
The function implements the CAMSHIFT object tracking algorithm @cite Bradski98 . First, it finds an
object center using meanShift and then adjusts the window size and finds the optimal rotation. The
function returns the rotated rectangle structure that includes the object position, size, and
orientation. The next position of the search window can be obtained with RotatedRect::boundingRect()

See the OpenCV sample camshiftdemo.c that tracks colored objects. Note:

  • (Python) A sample explaining the camshift tracking algorithm can be found at opencv_source_code/samples/python/camshift.py

Python prototype (for reference):

CamShift(probImage, window, criteria) -> retval, window
Link to this function

canny(image, threshold1, threshold2)

View Source
Positional Arguments
  • image: UMat.
  • threshold1: double.
  • threshold2: double.
Keyword Arguments
  • edges: UMat.
  • apertureSize: int.
  • l2gradient: bool.

Finds edges in an image using the Canny algorithm @cite Canny86 . The function finds edges in the input image and marks them in the output map edges using the Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The largest value is used to find initial segments of strong edges. See http://en.wikipedia.org/wiki/Canny_edge_detector

\f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude (
L2gradient=true ), or whether the default \f$L\_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough (
L2gradient=false ).

Python prototype (for reference):

Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]]) -> edges
Link to this function

canny(image, threshold1, threshold2, opts)

View Source

Variaint 1:

Positional Arguments
  • dx: UMat.
  • dy: UMat.
  • threshold1: double.
  • threshold2: double.
Keyword Arguments
  • edges: UMat.

  • l2gradient: bool.

    \overload Finds edges in an image using the Canny algorithm with custom image gradient. \f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough ( L2gradient=false ).

Python prototype (for reference):

Canny(dx, dy, threshold1, threshold2[, edges[, L2gradient]]) -> edges

Variaint 2:

Positional Arguments
  • image: UMat.
  • threshold1: double.
  • threshold2: double.
Keyword Arguments
  • edges: UMat.
  • apertureSize: int.
  • l2gradient: bool.

Finds edges in an image using the Canny algorithm @cite Canny86 . The function finds edges in the input image and marks them in the output map edges using the Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The largest value is used to find initial segments of strong edges. See http://en.wikipedia.org/wiki/Canny_edge_detector

\f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude (
L2gradient=true ), or whether the default \f$L\_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough (
L2gradient=false ).

Python prototype (for reference):

Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]]) -> edges
Link to this function

canny(dx, dy, threshold1, threshold2, opts)

View Source
Positional Arguments
  • dx: UMat.
  • dy: UMat.
  • threshold1: double.
  • threshold2: double.
Keyword Arguments
  • edges: UMat.

  • l2gradient: bool.

    \overload Finds edges in an image using the Canny algorithm with custom image gradient. \f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough ( L2gradient=false ).

Python prototype (for reference):

Canny(dx, dy, threshold1, threshold2[, edges[, L2gradient]]) -> edges
Positional Arguments
  • x: UMat.
  • y: UMat.
Keyword Arguments
  • magnitude: UMat.
  • angle: UMat.
  • angleInDegrees: bool.

Calculates the magnitude and angle of 2D vectors. The function cv::cartToPolar calculates either the magnitude, angle, or both for every 2D vector (x(I),y(I)): \f[\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}\f] The angles are calculated with accuracy about 0.3 degrees. For the point (0,0), the angle is set to 0.

double-precision floating-point array.
x; the angles are measured in radians (from 0 to 2\*Pi) or in degrees (0 to 360 degrees).
in radians (which is by default), or in degrees.

@sa Sobel, Scharr

Python prototype (for reference):

cartToPolar(x, y[, magnitude[, angle[, angleInDegrees]]]) -> magnitude, angle
Positional Arguments
  • x: UMat.
  • y: UMat.
Keyword Arguments
  • magnitude: UMat.
  • angle: UMat.
  • angleInDegrees: bool.

Calculates the magnitude and angle of 2D vectors. The function cv::cartToPolar calculates either the magnitude, angle, or both for every 2D vector (x(I),y(I)): \f[\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}\f] The angles are calculated with accuracy about 0.3 degrees. For the point (0,0), the angle is set to 0.

double-precision floating-point array.
x; the angles are measured in radians (from 0 to 2\*Pi) or in degrees (0 to 360 degrees).
in radians (which is by default), or in degrees.

@sa Sobel, Scharr

Python prototype (for reference):

cartToPolar(x, y[, magnitude[, angle[, angleInDegrees]]]) -> magnitude, angle
Link to this function

checkChessboard(img, size)

View Source

Python prototype (for reference):

checkChessboard(img, size) -> retval
Link to this function

checkHardwareSupport(feature)

View Source

Returns true if the specified feature is supported by the host hardware. The function returns true if the host hardware supports the specified feature. When user calls setUseOptimized(false), the subsequent calls to checkHardwareSupport() will return false until setUseOptimized(true) is called. This way user can dynamically switch on and off the optimized code in OpenCV.

Python prototype (for reference):

checkHardwareSupport(feature) -> retval
Positional Arguments
  • a: UMat.
Keyword Arguments
  • quiet: bool.
  • minVal: double.
  • maxVal: double.

Checks every element of an input array for invalid values. The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal > -DBL_MAX and maxVal \< DBL_MAX, the function also checks that each value is between minVal and maxVal. In case of multi-channel arrays, each channel is processed independently. If some values are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the function either returns false (when quiet=true) or throws an exception.

are out of range or they throw an exception.
elements.

Python prototype (for reference):

checkRange(a[, quiet[, minVal[, maxVal]]]) -> retval, pos
Positional Arguments
  • a: UMat.
Keyword Arguments
  • quiet: bool.
  • minVal: double.
  • maxVal: double.

Checks every element of an input array for invalid values. The function cv::checkRange checks that every array element is neither NaN nor infinite. When minVal > -DBL_MAX and maxVal \< DBL_MAX, the function also checks that each value is between minVal and maxVal. In case of multi-channel arrays, each channel is processed independently. If some values are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the function either returns false (when quiet=true) or throws an exception.

are out of range or they throw an exception.
elements.

Python prototype (for reference):

checkRange(a[, quiet[, minVal[, maxVal]]]) -> retval, pos
Link to this function

circle(img, center, radius, color)

View Source
Positional Arguments
  • img: UMat.
  • center: Point.
  • radius: int.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a circle. The function cv::circle draws a simple or filled circle with a given center and radius.

mean that a filled circle is to be drawn.

Python prototype (for reference):

circle(img, center, radius, color[, thickness[, lineType[, shift]]]) -> img
Link to this function

circle(img, center, radius, color, opts)

View Source
Positional Arguments
  • img: UMat.
  • center: Point.
  • radius: int.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a circle. The function cv::circle draws a simple or filled circle with a given center and radius.

mean that a filled circle is to be drawn.

Python prototype (for reference):

circle(img, center, radius, color[, thickness[, lineType[, shift]]]) -> img
Link to this function

clipLine(imgRect, pt1, pt2)

View Source

Has overloading in C++

Python prototype (for reference):

clipLine(imgRect, pt1, pt2) -> retval, pt1, pt2
Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.
  • red_mul: float.
  • green_mul: float.
  • blue_mul: float.

Given an original color image, two differently colored versions of this image can be mixed seamlessly. Multiplication factor is between .5 to 2.5.

Python prototype (for reference):

colorChange(src, mask[, dst[, red_mul[, green_mul[, blue_mul]]]]) -> dst
Link to this function

colorChange(src, mask, opts)

View Source
Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.
  • red_mul: float.
  • green_mul: float.
  • blue_mul: float.

Given an original color image, two differently colored versions of this image can be mixed seamlessly. Multiplication factor is between .5 to 2.5.

Python prototype (for reference):

colorChange(src, mask[, dst[, red_mul[, green_mul[, blue_mul]]]]) -> dst
Link to this function

compare(src1, src2, cmpop)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • cmpop: int.
Keyword Arguments
  • dst: UMat.

Performs the per-element comparison of two arrays or an array and scalar value. The function compares:

 Elements of two arrays when src1 and src2 have the same size:

\f[\texttt{dst} (I) = \texttt{src1} (I) \,\texttt{cmpop}\, \texttt{src2} (I)\f]

 Elements of src1 with a scalar src2 when src2 is constructed from

Scalar or has a single element: \f[\texttt{dst} (I) = \texttt{src1}(I) \,\texttt{cmpop}\, \texttt{src2}\f]

 src1 with elements of src2 when src1 is constructed from Scalar or

has a single element: \f[\texttt{dst} (I) = \texttt{src1} \,\texttt{cmpop}\, \texttt{src2} (I)\f] When the comparison result is true, the corresponding element of output array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:

Mat dst1 = src1 >= src2;
Mat dst2 = src1 < 8;
...
the input arrays.

@sa checkRange, min, max, threshold

Python prototype (for reference):

compare(src1, src2, cmpop[, dst]) -> dst
Link to this function

compare(src1, src2, cmpop, opts)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • cmpop: int.
Keyword Arguments
  • dst: UMat.

Performs the per-element comparison of two arrays or an array and scalar value. The function compares:

 Elements of two arrays when src1 and src2 have the same size:

\f[\texttt{dst} (I) = \texttt{src1} (I) \,\texttt{cmpop}\, \texttt{src2} (I)\f]

 Elements of src1 with a scalar src2 when src2 is constructed from

Scalar or has a single element: \f[\texttt{dst} (I) = \texttt{src1}(I) \,\texttt{cmpop}\, \texttt{src2}\f]

 src1 with elements of src2 when src1 is constructed from Scalar or

has a single element: \f[\texttt{dst} (I) = \texttt{src1} \,\texttt{cmpop}\, \texttt{src2} (I)\f] When the comparison result is true, the corresponding element of output array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:

Mat dst1 = src1 >= src2;
Mat dst2 = src1 < 8;
...
the input arrays.

@sa checkRange, min, max, threshold

Python prototype (for reference):

compare(src1, src2, cmpop[, dst]) -> dst
Link to this function

compareHist(h1, h2, method)

View Source

Compares two histograms. The function cv::compareHist compares two dense or two sparse histograms using the specified method. The function returns \f$d(H_1, H_2)\f$ . While the function works well with 1-, 2-, 3-dimensional dense histograms, it may not be suitable for high-dimensional sparse histograms. In such histograms, because of aliasing and sampling problems, the coordinates of non-zero histogram bins can slightly shift. To compare such histograms or more general sparse configurations of weighted points, consider using the #EMD function.

Python prototype (for reference):

compareHist(H1, H2, method) -> retval
Positional Arguments
  • m: UMat.
Keyword Arguments
  • lowerToUpper: bool.

Copies the lower or the upper half of a square matrix to its another half. The function cv::completeSymm copies the lower or the upper half of a square matrix to its another half. The matrix diagonal remains unchanged:

  • \f$\texttt{m}_{ij}=\texttt{m}_{ji}\f$ for \f$i > j\f$ if lowerToUpper=false
  • \f$\texttt{m}_{ij}=\texttt{m}_{ji}\f$ for \f$i < j\f$ if lowerToUpper=true the upper half. Otherwise, the upper half is copied to the lower half. @sa flip, transpose

Python prototype (for reference):

completeSymm(m[, lowerToUpper]) -> m
Positional Arguments
  • m: UMat.
Keyword Arguments
  • lowerToUpper: bool.

Copies the lower or the upper half of a square matrix to its another half. The function cv::completeSymm copies the lower or the upper half of a square matrix to its another half. The matrix diagonal remains unchanged:

  • \f$\texttt{m}_{ij}=\texttt{m}_{ji}\f$ for \f$i > j\f$ if lowerToUpper=false
  • \f$\texttt{m}_{ij}=\texttt{m}_{ji}\f$ for \f$i < j\f$ if lowerToUpper=true the upper half. Otherwise, the upper half is copied to the lower half. @sa flip, transpose

Python prototype (for reference):

completeSymm(m[, lowerToUpper]) -> m
Link to this function

composeRT(rvec1, tvec1, rvec2, tvec2)

View Source
Positional Arguments
  • rvec1: UMat.
  • tvec1: UMat.
  • rvec2: UMat.
  • tvec2: UMat.
Keyword Arguments
  • rvec3: UMat.
  • tvec3: UMat.
  • dr3dr1: UMat.
  • dr3dt1: UMat.
  • dr3dr2: UMat.
  • dr3dt2: UMat.
  • dt3dr1: UMat.
  • dt3dt1: UMat.
  • dt3dr2: UMat.
  • dt3dt2: UMat.

Combines two rotation-and-shift transformations. The functions compute: \f[\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\f] where \f$\mathrm{rodrigues}\f$ denotes a rotation vector to a rotation matrix transformation, and \f$\mathrm{rodrigues}^{-1}\f$ denotes the inverse transformation. See Rodrigues for details. Also, the functions can compute the derivatives of the output vectors with regards to the input vectors (see matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a function that contains a matrix multiplication.

Python prototype (for reference):

composeRT(rvec1, tvec1, rvec2, tvec2[, rvec3[, tvec3[, dr3dr1[, dr3dt1[, dr3dr2[, dr3dt2[, dt3dr1[, dt3dt1[, dt3dr2[, dt3dt2]]]]]]]]]]) -> rvec3, tvec3, dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1, dt3dt1, dt3dr2, dt3dt2
Link to this function

composeRT(rvec1, tvec1, rvec2, tvec2, opts)

View Source
Positional Arguments
  • rvec1: UMat.
  • tvec1: UMat.
  • rvec2: UMat.
  • tvec2: UMat.
Keyword Arguments
  • rvec3: UMat.
  • tvec3: UMat.
  • dr3dr1: UMat.
  • dr3dt1: UMat.
  • dr3dr2: UMat.
  • dr3dt2: UMat.
  • dt3dr1: UMat.
  • dt3dt1: UMat.
  • dt3dr2: UMat.
  • dt3dt2: UMat.

Combines two rotation-and-shift transformations. The functions compute: \f[\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,\f] where \f$\mathrm{rodrigues}\f$ denotes a rotation vector to a rotation matrix transformation, and \f$\mathrm{rodrigues}^{-1}\f$ denotes the inverse transformation. See Rodrigues for details. Also, the functions can compute the derivatives of the output vectors with regards to the input vectors (see matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a function that contains a matrix multiplication.

Python prototype (for reference):

composeRT(rvec1, tvec1, rvec2, tvec2[, rvec3[, tvec3[, dr3dr1[, dr3dt1[, dr3dr2[, dr3dt2[, dt3dr1[, dt3dt1[, dt3dr2[, dt3dt2]]]]]]]]]]) -> rvec3, tvec3, dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1, dt3dt1, dt3dr2, dt3dt2
Link to this function

computeCorrespondEpilines(points, whichImage, f)

View Source
Positional Arguments
  • points: UMat.
  • whichImage: int.
  • f: UMat.
Keyword Arguments
  • lines: UMat.

For points in an image of a stereo pair, computes the corresponding epilines in the other image.

vector\<Point2f\> .
Each line \f$ax + by + c=0\f$ is encoded by 3 numbers \f$(a, b, c)\f$ .

For every point in one of the two images of a stereo pair, the function finds the equation of the corresponding epipolar line in the other image. From the fundamental matrix definition (see #findFundamentalMat ), line \f$l^{(2)}_i\f$ in the second image for the point \f$p^{(1)}_i\f$ in the first image (when whichImage=1 ) is computed as: \f[l^{(2)}_i = F p^{(1)}_i\f] And vice versa, when whichImage=2, \f$l^{(1)}_i\f$ is computed from \f$p^{(2)}_i\f$ as: \f[l^{(1)}_i = F^T p^{(2)}_i\f] Line coefficients are defined up to a scale. They are normalized so that \f$a_i^2+b_i^2=1\f$ .

Python prototype (for reference):

computeCorrespondEpilines(points, whichImage, F[, lines]) -> lines
Link to this function

computeCorrespondEpilines(points, whichImage, f, opts)

View Source
Positional Arguments
  • points: UMat.
  • whichImage: int.
  • f: UMat.
Keyword Arguments
  • lines: UMat.

For points in an image of a stereo pair, computes the corresponding epilines in the other image.

vector\<Point2f\> .
Each line \f$ax + by + c=0\f$ is encoded by 3 numbers \f$(a, b, c)\f$ .

For every point in one of the two images of a stereo pair, the function finds the equation of the corresponding epipolar line in the other image. From the fundamental matrix definition (see #findFundamentalMat ), line \f$l^{(2)}_i\f$ in the second image for the point \f$p^{(1)}_i\f$ in the first image (when whichImage=1 ) is computed as: \f[l^{(2)}_i = F p^{(1)}_i\f] And vice versa, when whichImage=2, \f$l^{(1)}_i\f$ is computed from \f$p^{(2)}_i\f$ as: \f[l^{(1)}_i = F^T p^{(2)}_i\f] Line coefficients are defined up to a scale. They are normalized so that \f$a_i^2+b_i^2=1\f$ .

Python prototype (for reference):

computeCorrespondEpilines(points, whichImage, F[, lines]) -> lines
Link to this function

computeECC(templateImage, inputImage)

View Source
Positional Arguments
  • templateImage: UMat.
  • inputImage: UMat.
Keyword Arguments
  • inputMask: UMat.

Computes the Enhanced Correlation Coefficient value between two images @cite EP08 .

templateImage, same type as templateImage.

@sa findTransformECC

Python prototype (for reference):

computeECC(templateImage, inputImage[, inputMask]) -> retval
Link to this function

computeECC(templateImage, inputImage, opts)

View Source
Positional Arguments
  • templateImage: UMat.
  • inputImage: UMat.
Keyword Arguments
  • inputMask: UMat.

Computes the Enhanced Correlation Coefficient value between two images @cite EP08 .

templateImage, same type as templateImage.

@sa findTransformECC

Python prototype (for reference):

computeECC(templateImage, inputImage[, inputMask]) -> retval
Link to this function

connectedComponents(image)

View Source
Positional Arguments
  • image: UMat.
Keyword Arguments
  • labels: UMat.
  • connectivity: int.
  • ltype: int.

Has overloading in C++

Python prototype (for reference):

connectedComponents(image[, labels[, connectivity[, ltype]]]) -> retval, labels
Link to this function

connectedComponents(image, opts)

View Source
Positional Arguments
  • image: UMat.
Keyword Arguments
  • labels: UMat.
  • connectivity: int.
  • ltype: int.

Has overloading in C++

Python prototype (for reference):

connectedComponents(image[, labels[, connectivity[, ltype]]]) -> retval, labels
Link to this function

connectedComponentsWithAlgorithm(image, connectivity, ltype, ccltype)

View Source
Positional Arguments
  • image: UMat.
  • connectivity: int.
  • ltype: int.
  • ccltype: int.
Keyword Arguments
  • labels: UMat.

computes the connected components labeled image of boolean image image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while Spaghetti and BBDT do not. This function uses parallel version of the algorithms if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.

Python prototype (for reference):

connectedComponentsWithAlgorithm(image, connectivity, ltype, ccltype[, labels]) -> retval, labels
Link to this function

connectedComponentsWithAlgorithm(image, connectivity, ltype, ccltype, opts)

View Source
Positional Arguments
  • image: UMat.
  • connectivity: int.
  • ltype: int.
  • ccltype: int.
Keyword Arguments
  • labels: UMat.

computes the connected components labeled image of boolean image image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while Spaghetti and BBDT do not. This function uses parallel version of the algorithms if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.

Python prototype (for reference):

connectedComponentsWithAlgorithm(image, connectivity, ltype, ccltype[, labels]) -> retval, labels
Link to this function

connectedComponentsWithStats(image)

View Source
Positional Arguments
  • image: UMat.
Keyword Arguments
  • labels: UMat.
  • stats: UMat.
  • centroids: UMat.
  • connectivity: int.
  • ltype: int.

Has overloading in C++

Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
#ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.

Python prototype (for reference):

connectedComponentsWithStats(image[, labels[, stats[, centroids[, connectivity[, ltype]]]]]) -> retval, labels, stats, centroids
Link to this function

connectedComponentsWithStats(image, opts)

View Source
Positional Arguments
  • image: UMat.
Keyword Arguments
  • labels: UMat.
  • stats: UMat.
  • centroids: UMat.
  • connectivity: int.
  • ltype: int.

Has overloading in C++

Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
#ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.

Python prototype (for reference):

connectedComponentsWithStats(image[, labels[, stats[, centroids[, connectivity[, ltype]]]]]) -> retval, labels, stats, centroids
Link to this function

connectedComponentsWithStatsWithAlgorithm(image, connectivity, ltype, ccltype)

View Source
Positional Arguments
  • image: UMat.
  • connectivity: int.
  • ltype: int.
  • ccltype: int.
Keyword Arguments
  • labels: UMat.
  • stats: UMat.
  • centroids: UMat.

computes the connected components labeled image of boolean image and also produces a statistics output for each label image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while Spaghetti and BBDT do not. This function uses parallel version of the algorithms (statistics included) if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.

Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
#ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.

Python prototype (for reference):

connectedComponentsWithStatsWithAlgorithm(image, connectivity, ltype, ccltype[, labels[, stats[, centroids]]]) -> retval, labels, stats, centroids
Link to this function

connectedComponentsWithStatsWithAlgorithm(image, connectivity, ltype, ccltype, opts)

View Source
Positional Arguments
  • image: UMat.
  • connectivity: int.
  • ltype: int.
  • ccltype: int.
Keyword Arguments
  • labels: UMat.
  • stats: UMat.
  • centroids: UMat.

computes the connected components labeled image of boolean image and also produces a statistics output for each label image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image. ccltype specifies the connected components labeling algorithm to use, currently Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces a row major ordering of labels while Spaghetti and BBDT do not. This function uses parallel version of the algorithms (statistics included) if at least one allowed parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.

Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
#ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.

Python prototype (for reference):

connectedComponentsWithStatsWithAlgorithm(image, connectivity, ltype, ccltype[, labels[, stats[, centroids]]]) -> retval, labels, stats, centroids
Positional Arguments
  • contour: UMat.
Keyword Arguments
  • oriented: bool.

Calculates a contour area. The function computes a contour area. Similarly to moments , the area is computed using the Green formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using #drawContours or #fillPoly , can be different. Also, the function will most certainly give a wrong results for contours with self-intersections. Example:

vector<Point> contour;
contour.push_back(Point2f(0, 0));
contour.push_back(Point2f(10, 0));
contour.push_back(Point2f(10, 10));
contour.push_back(Point2f(5, 4));
double area0 = contourArea(contour);
vector<Point> approx;
approxPolyDP(contour, approx, 5, true);
double area1 = contourArea(approx);
cout << "area0 =" << area0 << endl <<
"area1 =" << area1 << endl <<
"approx poly vertices" << approx.size() << endl;
depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can
determine orientation of a contour by taking the sign of an area. By default, the parameter is
false, which means that the absolute value is returned.

Python prototype (for reference):

contourArea(contour[, oriented]) -> retval
Link to this function

contourArea(contour, opts)

View Source
Positional Arguments
  • contour: UMat.
Keyword Arguments
  • oriented: bool.

Calculates a contour area. The function computes a contour area. Similarly to moments , the area is computed using the Green formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using #drawContours or #fillPoly , can be different. Also, the function will most certainly give a wrong results for contours with self-intersections. Example:

vector<Point> contour;
contour.push_back(Point2f(0, 0));
contour.push_back(Point2f(10, 0));
contour.push_back(Point2f(10, 10));
contour.push_back(Point2f(5, 4));
double area0 = contourArea(contour);
vector<Point> approx;
approxPolyDP(contour, approx, 5, true);
double area1 = contourArea(approx);
cout << "area0 =" << area0 << endl <<
"area1 =" << area1 << endl <<
"approx poly vertices" << approx.size() << endl;
depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can
determine orientation of a contour by taking the sign of an area. By default, the parameter is
false, which means that the absolute value is returned.

Python prototype (for reference):

contourArea(contour[, oriented]) -> retval
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Converts an array to half precision floating number. This function converts FP32 (single precision floating point) from/to FP16 (half precision floating point). CV_16S format is used to represent FP16 data. There are two use modes (src -> dst): CV_32F -> CV_16S and CV_16S -> CV_32F. The input array has to have type of CV_32F or CV_16S to represent the bit depth. If the input array is neither of them, the function will raise an error. The format of half precision floating point is defined in IEEE 754-2008.

Python prototype (for reference):

convertFp16(src[, dst]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Converts an array to half precision floating number. This function converts FP32 (single precision floating point) from/to FP16 (half precision floating point). CV_16S format is used to represent FP16 data. There are two use modes (src -> dst): CV_32F -> CV_16S and CV_16S -> CV_32F. The input array has to have type of CV_32F or CV_16S to represent the bit depth. If the input array is neither of them, the function will raise an error. The format of half precision floating point is defined in IEEE 754-2008.

Python prototype (for reference):

convertFp16(src[, dst]) -> dst
Link to this function

convertMaps(map1, map2, dstmap1type)

View Source
Positional Arguments
  • map1: UMat.
  • map2: UMat.
  • dstmap1type: int.
Keyword Arguments
  • dstmap1: UMat.
  • dstmap2: UMat.
  • nninterpolation: bool.

Converts image transformation maps from one representation to another. The function converts a pair of maps for remap from one representation to another. The following options ( (map1.type(), map2.type()) \f$\rightarrow\f$ (dstmap1.type(), dstmap2.type()) ) are supported:

  • \f$\texttt{(CV_32FC1, CV_32FC1)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\f$. This is the most frequently used conversion operation, in which the original floating-point maps (see #remap) are converted to a more compact and much faster fixed-point representation. The first output array contains the rounded coordinates and the second array (created only when nninterpolation=false ) contains indices in the interpolation tables.
  • \f$\texttt{(CV_32FC2)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\f$. The same as above but the original maps are stored in one 2-channel matrix.
  • Reverse conversion. Obviously, the reconstructed floating-point maps will not be exactly the same as the originals. respectively. CV_32FC2 . nearest-neighbor or for a more complex interpolation. @sa remap, undistort, initUndistortRectifyMap

Python prototype (for reference):

convertMaps(map1, map2, dstmap1type[, dstmap1[, dstmap2[, nninterpolation]]]) -> dstmap1, dstmap2
Link to this function

convertMaps(map1, map2, dstmap1type, opts)

View Source
Positional Arguments
  • map1: UMat.
  • map2: UMat.
  • dstmap1type: int.
Keyword Arguments
  • dstmap1: UMat.
  • dstmap2: UMat.
  • nninterpolation: bool.

Converts image transformation maps from one representation to another. The function converts a pair of maps for remap from one representation to another. The following options ( (map1.type(), map2.type()) \f$\rightarrow\f$ (dstmap1.type(), dstmap2.type()) ) are supported:

  • \f$\texttt{(CV_32FC1, CV_32FC1)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\f$. This is the most frequently used conversion operation, in which the original floating-point maps (see #remap) are converted to a more compact and much faster fixed-point representation. The first output array contains the rounded coordinates and the second array (created only when nninterpolation=false ) contains indices in the interpolation tables.
  • \f$\texttt{(CV_32FC2)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\f$. The same as above but the original maps are stored in one 2-channel matrix.
  • Reverse conversion. Obviously, the reconstructed floating-point maps will not be exactly the same as the originals. respectively. CV_32FC2 . nearest-neighbor or for a more complex interpolation. @sa remap, undistort, initUndistortRectifyMap

Python prototype (for reference):

convertMaps(map1, map2, dstmap1type[, dstmap1[, dstmap2[, nninterpolation]]]) -> dstmap1, dstmap2
Link to this function

convertPointsFromHomogeneous(src)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Converts points from homogeneous to Euclidean space. The function converts points homogeneous to Euclidean space using perspective projection. That is, each point (x1, x2, ... x(n-1), xn) is converted to (x1/xn, x2/xn, ..., x(n-1)/xn). When xn=0, the output point coordinates will be (0,0,0,...).

Python prototype (for reference):

convertPointsFromHomogeneous(src[, dst]) -> dst
Link to this function

convertPointsFromHomogeneous(src, opts)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Converts points from homogeneous to Euclidean space. The function converts points homogeneous to Euclidean space using perspective projection. That is, each point (x1, x2, ... x(n-1), xn) is converted to (x1/xn, x2/xn, ..., x(n-1)/xn). When xn=0, the output point coordinates will be (0,0,0,...).

Python prototype (for reference):

convertPointsFromHomogeneous(src[, dst]) -> dst
Link to this function

convertPointsToHomogeneous(src)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Converts points from Euclidean to homogeneous space. The function converts points from Euclidean to homogeneous space by appending 1's to the tuple of point coordinates. That is, each point (x1, x2, ..., xn) is converted to (x1, x2, ..., xn, 1).

Python prototype (for reference):

convertPointsToHomogeneous(src[, dst]) -> dst
Link to this function

convertPointsToHomogeneous(src, opts)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Converts points from Euclidean to homogeneous space. The function converts points from Euclidean to homogeneous space by appending 1's to the tuple of point coordinates. That is, each point (x1, x2, ..., xn) is converted to (x1, x2, ..., xn, 1).

Python prototype (for reference):

convertPointsToHomogeneous(src[, dst]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • alpha: double.
  • beta: double.

Scales, calculates absolute values, and converts the result to 8-bit. On each element of the input array, the function convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type: \f[\texttt{dst} (I)= \texttt{saturate\_cast<uchar>} (| \texttt{src} (I)* \texttt{alpha} + \texttt{beta} |)\f] In case of multi-channel arrays, the function processes each channel independently. When the output is not 8-bit, the operation can be emulated by calling the Mat::convertTo method (or by using matrix expressions) and then by calculating an absolute value of the result. For example:

Mat_<float> A(30,30);
randu(A, Scalar(-100), Scalar(100));
Mat_<float> B = A*5 + 3;
B = abs(B);
// Mat_<float> B = abs(A*5+3) will also do the job,
// but it will allocate a temporary matrix

@sa Mat::convertTo, cv::abs(const Mat&)

Python prototype (for reference):

convertScaleAbs(src[, dst[, alpha[, beta]]]) -> dst
Link to this function

convertScaleAbs(src, opts)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • alpha: double.
  • beta: double.

Scales, calculates absolute values, and converts the result to 8-bit. On each element of the input array, the function convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type: \f[\texttt{dst} (I)= \texttt{saturate\_cast<uchar>} (| \texttt{src} (I)* \texttt{alpha} + \texttt{beta} |)\f] In case of multi-channel arrays, the function processes each channel independently. When the output is not 8-bit, the operation can be emulated by calling the Mat::convertTo method (or by using matrix expressions) and then by calculating an absolute value of the result. For example:

Mat_<float> A(30,30);
randu(A, Scalar(-100), Scalar(100));
Mat_<float> B = A*5 + 3;
B = abs(B);
// Mat_<float> B = abs(A*5+3) will also do the job,
// but it will allocate a temporary matrix

@sa Mat::convertTo, cv::abs(const Mat&)

Python prototype (for reference):

convertScaleAbs(src[, dst[, alpha[, beta]]]) -> dst
Positional Arguments
  • points: UMat.
Keyword Arguments
  • hull: UMat.
  • clockwise: bool.
  • returnPoints: bool.

Finds the convex hull of a point set. The function cv::convexHull finds the convex hull of a 2D point set using the Sklansky's algorithm @cite Sklansky82 that has O(N logN) complexity in the current implementation.

the first case, the hull elements are 0-based indices of the convex hull points in the original
array (since the set of convex hull points is a subset of the original point set). In the second
case, hull elements are the convex hull points themselves.
Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing
to the right, and its Y axis pointing upwards.
returns convex hull points. Otherwise, it returns indices of the convex hull points. When the
output array is std::vector, the flag is ignored, and the output depends on the type of the
vector: std::vector\<int\> implies returnPoints=false, std::vector\<Point\> implies
returnPoints=true.

Note: points and hull should be different arrays, inplace processing isn't supported. Check @ref tutorial_hull "the corresponding tutorial" for more details. useful links: https://www.learnopencv.com/convex-hull-using-opencv-in-python-and-c/

Python prototype (for reference):

convexHull(points[, hull[, clockwise[, returnPoints]]]) -> hull
Link to this function

convexHull(points, opts)

View Source
Positional Arguments
  • points: UMat.
Keyword Arguments
  • hull: UMat.
  • clockwise: bool.
  • returnPoints: bool.

Finds the convex hull of a point set. The function cv::convexHull finds the convex hull of a 2D point set using the Sklansky's algorithm @cite Sklansky82 that has O(N logN) complexity in the current implementation.

the first case, the hull elements are 0-based indices of the convex hull points in the original
array (since the set of convex hull points is a subset of the original point set). In the second
case, hull elements are the convex hull points themselves.
Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing
to the right, and its Y axis pointing upwards.
returns convex hull points. Otherwise, it returns indices of the convex hull points. When the
output array is std::vector, the flag is ignored, and the output depends on the type of the
vector: std::vector\<int\> implies returnPoints=false, std::vector\<Point\> implies
returnPoints=true.

Note: points and hull should be different arrays, inplace processing isn't supported. Check @ref tutorial_hull "the corresponding tutorial" for more details. useful links: https://www.learnopencv.com/convex-hull-using-opencv-in-python-and-c/

Python prototype (for reference):

convexHull(points[, hull[, clockwise[, returnPoints]]]) -> hull
Link to this function

convexityDefects(contour, convexhull)

View Source
Positional Arguments
  • contour: UMat.
  • convexhull: UMat.
Keyword Arguments
  • convexityDefects: UMat.

Finds the convexity defects of a contour. The figure below displays convexity defects of a hand contour: image

points that make the hull.
interface each convexity defect is represented as 4-element integer vector (a.k.a. #Vec4i):
(start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices
in the original contour of the convexity defect beginning, end and the farthest point, and
fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the
farthest contour point and the hull. That is, to get the floating-point value of the depth will be
fixpt_depth/256.0.

Python prototype (for reference):

convexityDefects(contour, convexhull[, convexityDefects]) -> convexityDefects
Link to this function

convexityDefects(contour, convexhull, opts)

View Source
Positional Arguments
  • contour: UMat.
  • convexhull: UMat.
Keyword Arguments
  • convexityDefects: UMat.

Finds the convexity defects of a contour. The figure below displays convexity defects of a hand contour: image

points that make the hull.
interface each convexity defect is represented as 4-element integer vector (a.k.a. #Vec4i):
(start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices
in the original contour of the convexity defect beginning, end and the farthest point, and
fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the
farthest contour point and the hull. That is, to get the floating-point value of the depth will be
fixpt_depth/256.0.

Python prototype (for reference):

convexityDefects(contour, convexhull[, convexityDefects]) -> convexityDefects
Link to this function

copyMakeBorder(src, top, bottom, left, right, borderType)

View Source
Positional Arguments
  • src: UMat.
  • top: int.
  • bottom: int.
  • left: int.
  • right: int.
  • borderType: int.
Keyword Arguments
  • dst: UMat.
  • value: Scalar.

Forms a border around an image. The function copies the source image into the middle of the destination image. The areas to the left, to the right, above and below the copied source image will be filled with extrapolated pixels. This is not what filtering functions based on it do (they extrapolate pixels on-fly), but what other more complex functions, including your own, may do to simplify image boundary handling. The function supports the mode when src is already in the middle of dst . In this case, the function does not copy src itself but simply constructs the border, for example:

// let border be the same in all directions
int border=2;
// constructs a larger image to fit both the image and the border
Mat gray_buf(rgb.rows + border*2, rgb.cols + border*2, rgb.depth());
// select the middle part of it w/o copying data
Mat gray(gray_canvas, Rect(border, border, rgb.cols, rgb.rows));
// convert image from RGB to grayscale
cvtColor(rgb, gray, COLOR_RGB2GRAY);
// form a border in-place
copyMakeBorder(gray, gray_buf, border, border,
border, border, BORDER_REPLICATE);
// now do some custom filtering ...
...

Note: When the source image is a part (ROI) of a bigger image, the function will try to use the pixels outside of the ROI to form a border. To disable this feature and always do extrapolation, as if src was not a ROI, use borderType | #BORDER_ISOLATED.

src.rows+top+bottom) .
to extrapolate. For example, top=1, bottom=1, left=1, right=1 mean that 1 pixel-wide border needs
to be built.

@sa borderInterpolate

Python prototype (for reference):

copyMakeBorder(src, top, bottom, left, right, borderType[, dst[, value]]) -> dst
Link to this function

copyMakeBorder(src, top, bottom, left, right, borderType, opts)

View Source
Positional Arguments
  • src: UMat.
  • top: int.
  • bottom: int.
  • left: int.
  • right: int.
  • borderType: int.
Keyword Arguments
  • dst: UMat.
  • value: Scalar.

Forms a border around an image. The function copies the source image into the middle of the destination image. The areas to the left, to the right, above and below the copied source image will be filled with extrapolated pixels. This is not what filtering functions based on it do (they extrapolate pixels on-fly), but what other more complex functions, including your own, may do to simplify image boundary handling. The function supports the mode when src is already in the middle of dst . In this case, the function does not copy src itself but simply constructs the border, for example:

// let border be the same in all directions
int border=2;
// constructs a larger image to fit both the image and the border
Mat gray_buf(rgb.rows + border*2, rgb.cols + border*2, rgb.depth());
// select the middle part of it w/o copying data
Mat gray(gray_canvas, Rect(border, border, rgb.cols, rgb.rows));
// convert image from RGB to grayscale
cvtColor(rgb, gray, COLOR_RGB2GRAY);
// form a border in-place
copyMakeBorder(gray, gray_buf, border, border,
border, border, BORDER_REPLICATE);
// now do some custom filtering ...
...

Note: When the source image is a part (ROI) of a bigger image, the function will try to use the pixels outside of the ROI to form a border. To disable this feature and always do extrapolation, as if src was not a ROI, use borderType | #BORDER_ISOLATED.

src.rows+top+bottom) .
to extrapolate. For example, top=1, bottom=1, left=1, right=1 mean that 1 pixel-wide border needs
to be built.

@sa borderInterpolate

Python prototype (for reference):

copyMakeBorder(src, top, bottom, left, right, borderType[, dst[, value]]) -> dst
Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.

This is an overloaded member function, provided for convenience (python) Copies the matrix to another one. When the operation mask is specified, if the Mat::create call shown above reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data.

reallocated.
elements need to be copied. The mask has to be of type CV_8U and can have 1 or multiple channels.

Python prototype (for reference):

copyTo(src, mask[, dst]) -> dst
Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.

This is an overloaded member function, provided for convenience (python) Copies the matrix to another one. When the operation mask is specified, if the Mat::create call shown above reallocates the matrix, the newly allocated matrix is initialized with all zeros before copying the data.

reallocated.
elements need to be copied. The mask has to be of type CV_8U and can have 1 or multiple channels.

Python prototype (for reference):

copyTo(src, mask[, dst]) -> dst
Link to this function

cornerEigenValsAndVecs(src, blockSize, ksize)

View Source
Positional Arguments
  • src: UMat.
  • blockSize: int.
  • ksize: int.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Calculates eigenvalues and eigenvectors of image blocks for corner detection. For every pixel \f$p\f$ , the function cornerEigenValsAndVecs considers a blockSize \f$\times\f$ blockSize neighborhood \f$S(p)\f$ . It calculates the covariation matrix of derivatives over the neighborhood as: \f[M = \begin{bmatrix} \sum _{S(p)}(dI/dx)^2 & \sum _{S(p)}dI/dx dI/dy \\ \sum _{S(p)}dI/dx dI/dy & \sum _{S(p)}(dI/dy)^2 \end{bmatrix}\f] where the derivatives are computed using the Sobel operator. After that, it finds eigenvectors and eigenvalues of \f$M\f$ and stores them in the destination image as \f$(\lambda_1, \lambda_2, x_1, y_1, x_2, y_2)\f$ where

  • \f$\lambda_1, \lambda_2\f$ are the non-sorted eigenvalues of \f$M\f$
  • \f$x_1, y_1\f$ are the eigenvectors corresponding to \f$\lambda_1\f$
  • \f$x_2, y_2\f$ are the eigenvectors corresponding to \f$\lambda_2\f$ The output of the function can be used for robust edge or corner detection. @sa cornerMinEigenVal, cornerHarris, preCornerDetect

Python prototype (for reference):

cornerEigenValsAndVecs(src, blockSize, ksize[, dst[, borderType]]) -> dst
Link to this function

cornerEigenValsAndVecs(src, blockSize, ksize, opts)

View Source
Positional Arguments
  • src: UMat.
  • blockSize: int.
  • ksize: int.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Calculates eigenvalues and eigenvectors of image blocks for corner detection. For every pixel \f$p\f$ , the function cornerEigenValsAndVecs considers a blockSize \f$\times\f$ blockSize neighborhood \f$S(p)\f$ . It calculates the covariation matrix of derivatives over the neighborhood as: \f[M = \begin{bmatrix} \sum _{S(p)}(dI/dx)^2 & \sum _{S(p)}dI/dx dI/dy \\ \sum _{S(p)}dI/dx dI/dy & \sum _{S(p)}(dI/dy)^2 \end{bmatrix}\f] where the derivatives are computed using the Sobel operator. After that, it finds eigenvectors and eigenvalues of \f$M\f$ and stores them in the destination image as \f$(\lambda_1, \lambda_2, x_1, y_1, x_2, y_2)\f$ where

  • \f$\lambda_1, \lambda_2\f$ are the non-sorted eigenvalues of \f$M\f$
  • \f$x_1, y_1\f$ are the eigenvectors corresponding to \f$\lambda_1\f$
  • \f$x_2, y_2\f$ are the eigenvectors corresponding to \f$\lambda_2\f$ The output of the function can be used for robust edge or corner detection. @sa cornerMinEigenVal, cornerHarris, preCornerDetect

Python prototype (for reference):

cornerEigenValsAndVecs(src, blockSize, ksize[, dst[, borderType]]) -> dst
Link to this function

cornerHarris(src, blockSize, ksize, k)

View Source
Positional Arguments
  • src: UMat.
  • blockSize: int.
  • ksize: int.
  • k: double.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Harris corner detector. The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and cornerEigenValsAndVecs , for each pixel \f$(x, y)\f$ it calculates a \f$2\times2\f$ gradient covariance matrix \f$M^{(x,y)}\f$ over a \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood. Then, it computes the following characteristic: \f[\texttt{dst} (x,y) = \mathrm{det} M^{(x,y)} - k \cdot \left ( \mathrm{tr} M^{(x,y)} \right )^2\f] Corners in the image can be found as the local maxima of this response map.

size as src .

Python prototype (for reference):

cornerHarris(src, blockSize, ksize, k[, dst[, borderType]]) -> dst
Link to this function

cornerHarris(src, blockSize, ksize, k, opts)

View Source
Positional Arguments
  • src: UMat.
  • blockSize: int.
  • ksize: int.
  • k: double.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Harris corner detector. The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and cornerEigenValsAndVecs , for each pixel \f$(x, y)\f$ it calculates a \f$2\times2\f$ gradient covariance matrix \f$M^{(x,y)}\f$ over a \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood. Then, it computes the following characteristic: \f[\texttt{dst} (x,y) = \mathrm{det} M^{(x,y)} - k \cdot \left ( \mathrm{tr} M^{(x,y)} \right )^2\f] Corners in the image can be found as the local maxima of this response map.

size as src .

Python prototype (for reference):

cornerHarris(src, blockSize, ksize, k[, dst[, borderType]]) -> dst
Link to this function

cornerMinEigenVal(src, blockSize)

View Source
Positional Arguments
  • src: UMat.
  • blockSize: int.
Keyword Arguments
  • dst: UMat.
  • ksize: int.
  • borderType: int.

Calculates the minimal eigenvalue of gradient matrices for corner detection. The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal eigenvalue of the covariance matrix of derivatives, that is, \f$\min(\lambda_1, \lambda_2)\f$ in terms of the formulae in the cornerEigenValsAndVecs description.

src .

Python prototype (for reference):

cornerMinEigenVal(src, blockSize[, dst[, ksize[, borderType]]]) -> dst
Link to this function

cornerMinEigenVal(src, blockSize, opts)

View Source
Positional Arguments
  • src: UMat.
  • blockSize: int.
Keyword Arguments
  • dst: UMat.
  • ksize: int.
  • borderType: int.

Calculates the minimal eigenvalue of gradient matrices for corner detection. The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal eigenvalue of the covariance matrix of derivatives, that is, \f$\min(\lambda_1, \lambda_2)\f$ in terms of the formulae in the cornerEigenValsAndVecs description.

src .

Python prototype (for reference):

cornerMinEigenVal(src, blockSize[, dst[, ksize[, borderType]]]) -> dst
Link to this function

cornerSubPix(image, corners, winSize, zeroZone, criteria)

View Source

Refines the corner locations. The function iterates to find the sub-pixel accurate location of corners or radial saddle points as described in @cite forstner1987fast, and as shown on the figure below. image Sub-pixel accurate corner locator is based on the observation that every vector from the center \f$q\f$ to a point \f$p\f$ located within a neighborhood of \f$q\f$ is orthogonal to the image gradient at \f$p\f$ subject to image and measurement noise. Consider the expression: \f[\epsilon _i = {DI_{p_i}}^T \cdot (q - p_i)\f] where \f${DI_{p_i}}\f$ is an image gradient at one of the points \f$p_i\f$ in a neighborhood of \f$q\f$ . The value of \f$q\f$ is to be found so that \f$\epsilon_i\f$ is minimized. A system of equations may be set up with \f$\epsilon_i\f$ set to zero: \f[\sum _i(DI_{p_i} \cdot {DI_{p_i}}^T) \cdot q - \sum _i(DI_{p_i} \cdot {DI_{p_i}}^T \cdot p_i)\f] where the gradients are summed within a neighborhood ("search window") of \f$q\f$ . Calling the first gradient term \f$G\f$ and the second gradient term \f$b\f$ gives: \f[q = G^{-1} \cdot b\f] The algorithm sets the center of the neighborhood window at this new center \f$q\f$ and then iterates until the center stays within a set threshold.

output.
then a \f$(5\*2+1) \times (5\*2+1) = 11 \times 11\f$ search window is used.
the summation in the formula below is not done. It is used sometimes to avoid possible
singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such
a size.
the process of corner position refinement stops either after criteria.maxCount iterations or when
the corner position moves by less than criteria.epsilon on some iteration.

Python prototype (for reference):

cornerSubPix(image, corners, winSize, zeroZone, criteria) -> corners
Link to this function

correctMatches(f, points1, points2)

View Source
Positional Arguments
  • f: UMat.
  • points1: UMat.
  • points2: UMat.
Keyword Arguments
  • newPoints1: UMat.
  • newPoints2: UMat.

Refines coordinates of corresponding points. The function implements the Optimal Triangulation Method (see Multiple View Geometry for details). For each given point correspondence points1[i] \<-> points2[i], and a fundamental matrix F, it computes the corrected correspondences newPoints1[i] \<-> newPoints2[i] that minimize the geometric error \f$d(points1[i], newPoints1[i])^2 + d(points2[i],newPoints2[i])^2\f$ (where \f$d(a,b)\f$ is the geometric distance between points \f$a\f$ and \f$b\f$ ) subject to the epipolar constraint \f$newPoints2^T * F * newPoints1 = 0\f$ .

Python prototype (for reference):

correctMatches(F, points1, points2[, newPoints1[, newPoints2]]) -> newPoints1, newPoints2
Link to this function

correctMatches(f, points1, points2, opts)

View Source
Positional Arguments
  • f: UMat.
  • points1: UMat.
  • points2: UMat.
Keyword Arguments
  • newPoints1: UMat.
  • newPoints2: UMat.

Refines coordinates of corresponding points. The function implements the Optimal Triangulation Method (see Multiple View Geometry for details). For each given point correspondence points1[i] \<-> points2[i], and a fundamental matrix F, it computes the corrected correspondences newPoints1[i] \<-> newPoints2[i] that minimize the geometric error \f$d(points1[i], newPoints1[i])^2 + d(points2[i],newPoints2[i])^2\f$ (where \f$d(a,b)\f$ is the geometric distance between points \f$a\f$ and \f$b\f$ ) subject to the epipolar constraint \f$newPoints2^T * F * newPoints1 = 0\f$ .

Python prototype (for reference):

correctMatches(F, points1, points2[, newPoints1[, newPoints2]]) -> newPoints1, newPoints2

Counts non-zero array elements. The function returns the number of non-zero elements in src : \f[\sum _{I: \; \texttt{src} (I) \ne0 } 1\f] @sa mean, meanStdDev, norm, minMaxLoc, calcCovarMatrix

Python prototype (for reference):

countNonZero(src) -> retval
Positional Arguments
Keyword Arguments
  • max_bits: int.
  • exclude_range: int.
  • cut: bool.

Creates AlignMTB object

usually good enough (31 and 63 pixels shift respectively).
median value.

Python prototype (for reference):

createAlignMTB([, max_bits[, exclude_range[, cut]]]) -> retval
Positional Arguments
Keyword Arguments
  • max_bits: int.
  • exclude_range: int.
  • cut: bool.

Creates AlignMTB object

usually good enough (31 and 63 pixels shift respectively).
median value.

Python prototype (for reference):

createAlignMTB([, max_bits[, exclude_range[, cut]]]) -> retval
Link to this function

createBackgroundSubtractorKNN()

View Source
Positional Arguments
Keyword Arguments
  • history: int.
  • dist2Threshold: double.
  • detectShadows: bool.

Creates KNN Background Subtractor

whether a pixel is close to that sample. This parameter does not affect the background update.
speed a bit, so if you do not need this feature, set the parameter to false.

Python prototype (for reference):

createBackgroundSubtractorKNN([, history[, dist2Threshold[, detectShadows]]]) -> retval
Link to this function

createBackgroundSubtractorKNN(opts)

View Source
Positional Arguments
Keyword Arguments
  • history: int.
  • dist2Threshold: double.
  • detectShadows: bool.

Creates KNN Background Subtractor

whether a pixel is close to that sample. This parameter does not affect the background update.
speed a bit, so if you do not need this feature, set the parameter to false.

Python prototype (for reference):

createBackgroundSubtractorKNN([, history[, dist2Threshold[, detectShadows]]]) -> retval
Link to this function

createBackgroundSubtractorMOG2()

View Source
Positional Arguments
Keyword Arguments
  • history: int.
  • varThreshold: double.
  • detectShadows: bool.

Creates MOG2 Background Subtractor

to decide whether a pixel is well described by the background model. This parameter does not
affect the background update.
speed a bit, so if you do not need this feature, set the parameter to false.

Python prototype (for reference):

createBackgroundSubtractorMOG2([, history[, varThreshold[, detectShadows]]]) -> retval
Link to this function

createBackgroundSubtractorMOG2(opts)

View Source
Positional Arguments
Keyword Arguments
  • history: int.
  • varThreshold: double.
  • detectShadows: bool.

Creates MOG2 Background Subtractor

to decide whether a pixel is well described by the background model. This parameter does not
affect the background update.
speed a bit, so if you do not need this feature, set the parameter to false.

Python prototype (for reference):

createBackgroundSubtractorMOG2([, history[, varThreshold[, detectShadows]]]) -> retval
Link to this function

createCalibrateDebevec()

View Source
Positional Arguments
Keyword Arguments
  • samples: int.
  • lambda: float.
  • random: bool.

Creates CalibrateDebevec object

response.
rectangular grid.

Python prototype (for reference):

createCalibrateDebevec([, samples[, lambda[, random]]]) -> retval
Link to this function

createCalibrateDebevec(opts)

View Source
Positional Arguments
Keyword Arguments
  • samples: int.
  • lambda: float.
  • random: bool.

Creates CalibrateDebevec object

response.
rectangular grid.

Python prototype (for reference):

createCalibrateDebevec([, samples[, lambda[, random]]]) -> retval
Link to this function

createCalibrateRobertson()

View Source
Positional Arguments
Keyword Arguments
  • max_iter: int.
  • threshold: float.

Creates CalibrateRobertson object

Python prototype (for reference):

createCalibrateRobertson([, max_iter[, threshold]]) -> retval
Link to this function

createCalibrateRobertson(opts)

View Source
Positional Arguments
Keyword Arguments
  • max_iter: int.
  • threshold: float.

Creates CalibrateRobertson object

Python prototype (for reference):

createCalibrateRobertson([, max_iter[, threshold]]) -> retval
Positional Arguments
Keyword Arguments
  • clipLimit: double.
  • tileGridSize: Size.

Creates a smart pointer to a cv::CLAHE class and initializes it.

equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column.

Python prototype (for reference):

createCLAHE([, clipLimit[, tileGridSize]]) -> retval
Positional Arguments
Keyword Arguments
  • clipLimit: double.
  • tileGridSize: Size.

Creates a smart pointer to a cv::CLAHE class and initializes it.

equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column.

Python prototype (for reference):

createCLAHE([, clipLimit[, tileGridSize]]) -> retval
Link to this function

createGeneralizedHoughBallard()

View Source

Creates a smart pointer to a cv::GeneralizedHoughBallard class and initializes it.

Python prototype (for reference):

createGeneralizedHoughBallard() -> retval
Link to this function

createGeneralizedHoughGuil()

View Source

Creates a smart pointer to a cv::GeneralizedHoughGuil class and initializes it.

Python prototype (for reference):

createGeneralizedHoughGuil() -> retval
Link to this function

createHanningWindow(winSize, type)

View Source
Positional Arguments
  • winSize: Size.
  • type: int.
Keyword Arguments
  • dst: UMat.

This function computes a Hanning window coefficients in two dimensions. See (http://en.wikipedia.org/wiki/Hann_function) and (http://en.wikipedia.org/wiki/Window_function) for more information. An example is shown below:

// create hanning window of size 100x100 and type CV_32F
Mat hann;
createHanningWindow(hann, Size(100, 100), CV_32F);

Python prototype (for reference):

createHanningWindow(winSize, type[, dst]) -> dst
Link to this function

createHanningWindow(winSize, type, opts)

View Source
Positional Arguments
  • winSize: Size.
  • type: int.
Keyword Arguments
  • dst: UMat.

This function computes a Hanning window coefficients in two dimensions. See (http://en.wikipedia.org/wiki/Hann_function) and (http://en.wikipedia.org/wiki/Window_function) for more information. An example is shown below:

// create hanning window of size 100x100 and type CV_32F
Mat hann;
createHanningWindow(hann, Size(100, 100), CV_32F);

Python prototype (for reference):

createHanningWindow(winSize, type[, dst]) -> dst
Link to this function

createLineSegmentDetector()

View Source
Positional Arguments
Keyword Arguments
  • refine: int.
  • scale: double.
  • sigma_scale: double.
  • quant: double.
  • ang_th: double.
  • log_eps: double.
  • density_th: double.
  • n_bins: int.

Creates a smart pointer to a LineSegmentDetector object and initializes it. The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want to edit those, as to tailor it for their own application.

Python prototype (for reference):

createLineSegmentDetector([, refine[, scale[, sigma_scale[, quant[, ang_th[, log_eps[, density_th[, n_bins]]]]]]]]) -> retval
Link to this function

createLineSegmentDetector(opts)

View Source
Positional Arguments
Keyword Arguments
  • refine: int.
  • scale: double.
  • sigma_scale: double.
  • quant: double.
  • ang_th: double.
  • log_eps: double.
  • density_th: double.
  • n_bins: int.

Creates a smart pointer to a LineSegmentDetector object and initializes it. The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want to edit those, as to tailor it for their own application.

Python prototype (for reference):

createLineSegmentDetector([, refine[, scale[, sigma_scale[, quant[, ang_th[, log_eps[, density_th[, n_bins]]]]]]]]) -> retval

Creates MergeDebevec object

Python prototype (for reference):

createMergeDebevec() -> retval
Positional Arguments
Keyword Arguments
  • contrast_weight: float.
  • saturation_weight: float.
  • exposure_weight: float.

Creates MergeMertens object

Python prototype (for reference):

createMergeMertens([, contrast_weight[, saturation_weight[, exposure_weight]]]) -> retval
Link to this function

createMergeMertens(opts)

View Source
Positional Arguments
Keyword Arguments
  • contrast_weight: float.
  • saturation_weight: float.
  • exposure_weight: float.

Creates MergeMertens object

Python prototype (for reference):

createMergeMertens([, contrast_weight[, saturation_weight[, exposure_weight]]]) -> retval

Creates MergeRobertson object

Python prototype (for reference):

createMergeRobertson() -> retval
Positional Arguments
Keyword Arguments
  • gamma: float.

Creates simple linear mapper with gamma correction

equal to 2.2f is suitable for most displays.
Generally gamma \> 1 brightens the image and gamma \< 1 darkens it.

Python prototype (for reference):

createTonemap([, gamma]) -> retval
Positional Arguments
Keyword Arguments
  • gamma: float.

Creates simple linear mapper with gamma correction

equal to 2.2f is suitable for most displays.
Generally gamma \> 1 brightens the image and gamma \< 1 darkens it.

Python prototype (for reference):

createTonemap([, gamma]) -> retval
Positional Arguments
Keyword Arguments
  • gamma: float.
  • saturation: float.
  • bias: float.

Creates TonemapDrago object

than 1 increase saturation and values less than 1 decrease it.
results, default value is 0.85.

Python prototype (for reference):

createTonemapDrago([, gamma[, saturation[, bias]]]) -> retval
Link to this function

createTonemapDrago(opts)

View Source
Positional Arguments
Keyword Arguments
  • gamma: float.
  • saturation: float.
  • bias: float.

Creates TonemapDrago object

than 1 increase saturation and values less than 1 decrease it.
results, default value is 0.85.

Python prototype (for reference):

createTonemapDrago([, gamma[, saturation[, bias]]]) -> retval
Positional Arguments
Keyword Arguments
  • gamma: float.
  • scale: float.
  • saturation: float.

Creates TonemapMantiuk object

dynamic range. Values from 0.6 to 0.9 produce best results.

Python prototype (for reference):

createTonemapMantiuk([, gamma[, scale[, saturation]]]) -> retval
Link to this function

createTonemapMantiuk(opts)

View Source
Positional Arguments
Keyword Arguments
  • gamma: float.
  • scale: float.
  • saturation: float.

Creates TonemapMantiuk object

dynamic range. Values from 0.6 to 0.9 produce best results.

Python prototype (for reference):

createTonemapMantiuk([, gamma[, scale[, saturation]]]) -> retval
Positional Arguments
Keyword Arguments
  • gamma: float.
  • intensity: float.
  • light_adapt: float.
  • color_adapt: float.

Creates TonemapReinhard object

value, if 0 it's global, otherwise it's a weighted mean of this two cases.
if 0 adaptation level is the same for each channel.

Python prototype (for reference):

createTonemapReinhard([, gamma[, intensity[, light_adapt[, color_adapt]]]]) -> retval
Link to this function

createTonemapReinhard(opts)

View Source
Positional Arguments
Keyword Arguments
  • gamma: float.
  • intensity: float.
  • light_adapt: float.
  • color_adapt: float.

Creates TonemapReinhard object

value, if 0 it's global, otherwise it's a weighted mean of this two cases.
if 0 adaptation level is the same for each channel.

Python prototype (for reference):

createTonemapReinhard([, gamma[, intensity[, light_adapt[, color_adapt]]]]) -> retval

Computes the cube root of an argument. The function cubeRoot computes \f$\sqrt[3]{\texttt{val}}\f$. Negative arguments are handled correctly. NaN and Inf are not handled. The accuracy approaches the maximum possible accuracy for single-precision data.

Python prototype (for reference):

cubeRoot(val) -> retval
Positional Arguments
  • src: UMat.
  • code: int.
Keyword Arguments
  • dst: UMat.
  • dstCn: int.

Converts an image from one color space to another. The function converts an input image from one color space to another. In case of a transformation to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on. The conventional ranges for R, G, and B channel values are:

  • 0 to 255 for CV_8U images
  • 0 to 65535 for CV_16U images
  • 0 to 1 for CV_32F images In case of linear transformations, the range does not matter. But in case of a non-linear transformation, an input RGB image should be normalized to the proper value range to get the correct results, for example, for RGB \f$\rightarrow\f$ L*u*v* transformation. For example, if you have a 32-bit floating-point image directly converted from an 8-bit image without any scaling, then it will have the 0..255 value range instead of 0..1 assumed by the function. So, before calling #cvtColor , you need first to scale the image down:
    img *= 1./255;
    cvtColor(img, img, COLOR_BGR2Luv);
    If you use #cvtColor with 8-bit images, the conversion will have some information lost. For many applications, this will not be noticeable but it is recommended to use 32-bit images in applications that need the full range of colors or that convert an image before an operation and then convert back. If conversion adds the alpha channel, its value will set to the maximum of corresponding channel range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F. floating-point. channels is derived automatically from src and code. @see @ref imgproc_color_conversions

Python prototype (for reference):

cvtColor(src, code[, dst[, dstCn]]) -> dst
Link to this function

cvtColor(src, code, opts)

View Source
Positional Arguments
  • src: UMat.
  • code: int.
Keyword Arguments
  • dst: UMat.
  • dstCn: int.

Converts an image from one color space to another. The function converts an input image from one color space to another. In case of a transformation to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on. The conventional ranges for R, G, and B channel values are:

  • 0 to 255 for CV_8U images
  • 0 to 65535 for CV_16U images
  • 0 to 1 for CV_32F images In case of linear transformations, the range does not matter. But in case of a non-linear transformation, an input RGB image should be normalized to the proper value range to get the correct results, for example, for RGB \f$\rightarrow\f$ L*u*v* transformation. For example, if you have a 32-bit floating-point image directly converted from an 8-bit image without any scaling, then it will have the 0..255 value range instead of 0..1 assumed by the function. So, before calling #cvtColor , you need first to scale the image down:
    img *= 1./255;
    cvtColor(img, img, COLOR_BGR2Luv);
    If you use #cvtColor with 8-bit images, the conversion will have some information lost. For many applications, this will not be noticeable but it is recommended to use 32-bit images in applications that need the full range of colors or that convert an image before an operation and then convert back. If conversion adds the alpha channel, its value will set to the maximum of corresponding channel range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F. floating-point. channels is derived automatically from src and code. @see @ref imgproc_color_conversions

Python prototype (for reference):

cvtColor(src, code[, dst[, dstCn]]) -> dst
Link to this function

cvtColorTwoPlane(src1, src2, code)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • code: int.
Keyword Arguments
  • dst: UMat.

Converts an image from one color space to another where the source image is stored in two planes. This function only supports YUV420 to RGB conversion as of now.

- #COLOR_YUV2BGR_NV12
- #COLOR_YUV2RGB_NV12
- #COLOR_YUV2BGRA_NV12
- #COLOR_YUV2RGBA_NV12
- #COLOR_YUV2BGR_NV21
- #COLOR_YUV2RGB_NV21
- #COLOR_YUV2BGRA_NV21
- #COLOR_YUV2RGBA_NV21

Python prototype (for reference):

cvtColorTwoPlane(src1, src2, code[, dst]) -> dst
Link to this function

cvtColorTwoPlane(src1, src2, code, opts)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • code: int.
Keyword Arguments
  • dst: UMat.

Converts an image from one color space to another where the source image is stored in two planes. This function only supports YUV420 to RGB conversion as of now.

- #COLOR_YUV2BGR_NV12
- #COLOR_YUV2RGB_NV12
- #COLOR_YUV2BGRA_NV12
- #COLOR_YUV2RGBA_NV12
- #COLOR_YUV2BGR_NV21
- #COLOR_YUV2RGB_NV21
- #COLOR_YUV2BGRA_NV21
- #COLOR_YUV2RGBA_NV21

Python prototype (for reference):

cvtColorTwoPlane(src1, src2, code[, dst]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Performs a forward or inverse discrete Cosine transform of 1D or 2D array. The function cv::dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D floating-point array:

  • Forward Cosine transform of a 1D vector of N elements: \f[Y = C^{(N)} \cdot X\f] where \f[C^{(N)}_{jk}= \sqrt{\alpha_j/N} \cos \left ( \frac{\pi(2k+1)j}{2N} \right )\f] and \f$\alpha_0=1\f$, \f$\alpha_j=2\f$ for j > 0.
  • Inverse Cosine transform of a 1D vector of N elements: \f[X = \left (C^{(N)} \right )^{-1} \cdot Y = \left (C^{(N)} \right )^T \cdot Y\f] (since \f$C^{(N)}\f$ is an orthogonal matrix, \f$C^{(N)} \cdot \left(C^{(N)}\right)^T = I\f$ )
  • Forward 2D Cosine transform of M x N matrix: \f[Y = C^{(N)} \cdot X \cdot \left (C^{(N)} \right )^T\f]
  • Inverse 2D Cosine transform of M x N matrix: \f[X = \left (C^{(N)} \right )^T \cdot X \cdot C^{(N)}\f] The function chooses the mode of operation by looking at the flags and size of the input array:
  • If (flags & #DCT_INVERSE) == 0 , the function does a forward 1D or 2D transform. Otherwise, it is an inverse 1D or 2D transform.
  • If (flags & #DCT_ROWS) != 0 , the function performs a 1D transform of each row.
  • If the array is a single column or a single row, the function performs a 1D transform.
  • If none of the above is true, the function performs a 2D transform. Note: Currently dct supports even-size arrays (2, 4, 6 ...). For data analysis and approximation, you can pad the array when necessary. Also, the function performance depends very much, and not monotonically, on the array size (see getOptimalDFTSize ). In the current implementation DCT of a vector of size N is calculated via DFT of a vector of size N/2 . Thus, the optimal DCT size N1 >= N can be calculated as:
    size_t getOptimalDCTSize(size_t N) { return 2*getOptimalDFTSize((N+1)/2); }
    N1 = getOptimalDCTSize(N);
    @sa dft , getOptimalDFTSize , idct

Python prototype (for reference):

dct(src[, dst[, flags]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Performs a forward or inverse discrete Cosine transform of 1D or 2D array. The function cv::dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D floating-point array:

  • Forward Cosine transform of a 1D vector of N elements: \f[Y = C^{(N)} \cdot X\f] where \f[C^{(N)}_{jk}= \sqrt{\alpha_j/N} \cos \left ( \frac{\pi(2k+1)j}{2N} \right )\f] and \f$\alpha_0=1\f$, \f$\alpha_j=2\f$ for j > 0.
  • Inverse Cosine transform of a 1D vector of N elements: \f[X = \left (C^{(N)} \right )^{-1} \cdot Y = \left (C^{(N)} \right )^T \cdot Y\f] (since \f$C^{(N)}\f$ is an orthogonal matrix, \f$C^{(N)} \cdot \left(C^{(N)}\right)^T = I\f$ )
  • Forward 2D Cosine transform of M x N matrix: \f[Y = C^{(N)} \cdot X \cdot \left (C^{(N)} \right )^T\f]
  • Inverse 2D Cosine transform of M x N matrix: \f[X = \left (C^{(N)} \right )^T \cdot X \cdot C^{(N)}\f] The function chooses the mode of operation by looking at the flags and size of the input array:
  • If (flags & #DCT_INVERSE) == 0 , the function does a forward 1D or 2D transform. Otherwise, it is an inverse 1D or 2D transform.
  • If (flags & #DCT_ROWS) != 0 , the function performs a 1D transform of each row.
  • If the array is a single column or a single row, the function performs a 1D transform.
  • If none of the above is true, the function performs a 2D transform. Note: Currently dct supports even-size arrays (2, 4, 6 ...). For data analysis and approximation, you can pad the array when necessary. Also, the function performance depends very much, and not monotonically, on the array size (see getOptimalDFTSize ). In the current implementation DCT of a vector of size N is calculated via DFT of a vector of size N/2 . Thus, the optimal DCT size N1 >= N can be calculated as:
    size_t getOptimalDCTSize(size_t N) { return 2*getOptimalDFTSize((N+1)/2); }
    N1 = getOptimalDCTSize(N);
    @sa dft , getOptimalDFTSize , idct

Python prototype (for reference):

dct(src[, dst[, flags]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • grayscale: UMat.
  • color_boost: UMat.

Transforms a color image to a grayscale image. It is a basic tool in digital printing, stylized black-and-white photograph rendering, and in many single channel image processing applications @cite CL12 . This function is to be applied on color images.

Python prototype (for reference):

decolor(src[, grayscale[, color_boost]]) -> grayscale, color_boost
Positional Arguments
  • src: UMat.
Keyword Arguments
  • grayscale: UMat.
  • color_boost: UMat.

Transforms a color image to a grayscale image. It is a basic tool in digital printing, stylized black-and-white photograph rendering, and in many single channel image processing applications @cite CL12 . This function is to be applied on color images.

Python prototype (for reference):

decolor(src[, grayscale[, color_boost]]) -> grayscale, color_boost
Link to this function

decomposeEssentialMat(e)

View Source
Positional Arguments
  • e: UMat.
Keyword Arguments
  • r1: UMat.
  • r2: UMat.
  • t: UMat.

Decompose an essential matrix to possible rotations and translation. This function decomposes the essential matrix E using svd decomposition @cite HartleyZ00. In general, four possible poses exist for the decomposition of E. They are \f$[R_1, t]\f$, \f$[R_1, -t]\f$, \f$[R_2, t]\f$, \f$[R_2, -t]\f$. If E gives the epipolar constraint \f$[p_2; 1]^T A^{-T} E A^{-1} [p_1; 1] = 0\f$ between the image points \f$p_1\f$ in the first image and \f$p_2\f$ in second image, then any of the tuples \f$[R_1, t]\f$, \f$[R_1, -t]\f$, \f$[R_2, t]\f$, \f$[R_2, -t]\f$ is a change of basis from the first camera's coordinate system to the second camera's coordinate system. However, by decomposing E, one can only get the direction of the translation. For this reason, the translation t is returned with unit length.

Python prototype (for reference):

decomposeEssentialMat(E[, R1[, R2[, t]]]) -> R1, R2, t
Link to this function

decomposeEssentialMat(e, opts)

View Source
Positional Arguments
  • e: UMat.
Keyword Arguments
  • r1: UMat.
  • r2: UMat.
  • t: UMat.

Decompose an essential matrix to possible rotations and translation. This function decomposes the essential matrix E using svd decomposition @cite HartleyZ00. In general, four possible poses exist for the decomposition of E. They are \f$[R_1, t]\f$, \f$[R_1, -t]\f$, \f$[R_2, t]\f$, \f$[R_2, -t]\f$. If E gives the epipolar constraint \f$[p_2; 1]^T A^{-T} E A^{-1} [p_1; 1] = 0\f$ between the image points \f$p_1\f$ in the first image and \f$p_2\f$ in second image, then any of the tuples \f$[R_1, t]\f$, \f$[R_1, -t]\f$, \f$[R_2, t]\f$, \f$[R_2, -t]\f$ is a change of basis from the first camera's coordinate system to the second camera's coordinate system. However, by decomposing E, one can only get the direction of the translation. For this reason, the translation t is returned with unit length.

Python prototype (for reference):

decomposeEssentialMat(E[, R1[, R2[, t]]]) -> R1, R2, t
Link to this function

decomposeHomographyMat(h, k)

View Source
Positional Arguments
  • h: UMat.
  • k: UMat.
Keyword Arguments
  • rotations: vector_UMat.
  • translations: vector_UMat.
  • normals: vector_UMat.

Decompose a homography matrix to rotation(s), translation(s) and plane normal(s). This function extracts relative camera motion between two views of a planar object and returns up to four mathematical solution tuples of rotation, translation, and plane normal. The decomposition of the homography matrix H is described in detail in @cite Malis. If the homography H, induced by the plane, gives the constraint \f[s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\f] on the source image points \f$p_i\f$ and the destination image points \f$p'_i\f$, then the tuple of rotations[k] and translations[k] is a change of basis from the source camera's coordinate system to the destination camera's coordinate system. However, by decomposing H, one can only get the translation normalized by the (typically unknown) depth of the scene, i.e. its direction but with normalized length. If point correspondences are available, at least two solutions may further be invalidated, by applying positive depth constraint, i.e. all points must be in front of the camera.

Python prototype (for reference):

decomposeHomographyMat(H, K[, rotations[, translations[, normals]]]) -> retval, rotations, translations, normals
Link to this function

decomposeHomographyMat(h, k, opts)

View Source
Positional Arguments
  • h: UMat.
  • k: UMat.
Keyword Arguments
  • rotations: vector_UMat.
  • translations: vector_UMat.
  • normals: vector_UMat.

Decompose a homography matrix to rotation(s), translation(s) and plane normal(s). This function extracts relative camera motion between two views of a planar object and returns up to four mathematical solution tuples of rotation, translation, and plane normal. The decomposition of the homography matrix H is described in detail in @cite Malis. If the homography H, induced by the plane, gives the constraint \f[s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\f] on the source image points \f$p_i\f$ and the destination image points \f$p'_i\f$, then the tuple of rotations[k] and translations[k] is a change of basis from the source camera's coordinate system to the destination camera's coordinate system. However, by decomposing H, one can only get the translation normalized by the (typically unknown) depth of the scene, i.e. its direction but with normalized length. If point correspondences are available, at least two solutions may further be invalidated, by applying positive depth constraint, i.e. all points must be in front of the camera.

Python prototype (for reference):

decomposeHomographyMat(H, K[, rotations[, translations[, normals]]]) -> retval, rotations, translations, normals
Link to this function

decomposeProjectionMatrix(projMatrix)

View Source
Positional Arguments
  • projMatrix: UMat.
Keyword Arguments
  • cameraMatrix: UMat.
  • rotMatrix: UMat.
  • transVect: UMat.
  • rotMatrixX: UMat.
  • rotMatrixY: UMat.
  • rotMatrixZ: UMat.
  • eulerAngles: UMat.

Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.

degrees.

The function computes a decomposition of a projection matrix into a calibration and a rotation matrix and the position of a camera. It optionally returns three rotation matrices, one for each axis, and three Euler angles that could be used in OpenGL. Note, there is always more than one sequence of rotations about the three principal axes that results in the same orientation of an object, e.g. see @cite Slabaugh . Returned tree rotation matrices and corresponding three Euler angles are only one of the possible solutions. The function is based on RQDecomp3x3 .

Python prototype (for reference):

decomposeProjectionMatrix(projMatrix[, cameraMatrix[, rotMatrix[, transVect[, rotMatrixX[, rotMatrixY[, rotMatrixZ[, eulerAngles]]]]]]]) -> cameraMatrix, rotMatrix, transVect, rotMatrixX, rotMatrixY, rotMatrixZ, eulerAngles
Link to this function

decomposeProjectionMatrix(projMatrix, opts)

View Source
Positional Arguments
  • projMatrix: UMat.
Keyword Arguments
  • cameraMatrix: UMat.
  • rotMatrix: UMat.
  • transVect: UMat.
  • rotMatrixX: UMat.
  • rotMatrixY: UMat.
  • rotMatrixZ: UMat.
  • eulerAngles: UMat.

Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.

degrees.

The function computes a decomposition of a projection matrix into a calibration and a rotation matrix and the position of a camera. It optionally returns three rotation matrices, one for each axis, and three Euler angles that could be used in OpenGL. Note, there is always more than one sequence of rotations about the three principal axes that results in the same orientation of an object, e.g. see @cite Slabaugh . Returned tree rotation matrices and corresponding three Euler angles are only one of the possible solutions. The function is based on RQDecomp3x3 .

Python prototype (for reference):

decomposeProjectionMatrix(projMatrix[, cameraMatrix[, rotMatrix[, transVect[, rotMatrixX[, rotMatrixY[, rotMatrixZ[, eulerAngles]]]]]]]) -> cameraMatrix, rotMatrix, transVect, rotMatrixX, rotMatrixY, rotMatrixZ, eulerAngles
Positional Arguments
  • src: UMat.
  • code: int.
Keyword Arguments
  • dst: UMat.
  • dstCn: int.

main function for all demosaicing processes

channels is derived automatically from src and code.

The function can do the following transformations:

  • Demosaicing using bilinear interpolation #COLOR_BayerBG2BGR , #COLOR_BayerGB2BGR , #COLOR_BayerRG2BGR , #COLOR_BayerGR2BGR #COLOR_BayerBG2GRAY , #COLOR_BayerGB2GRAY , #COLOR_BayerRG2GRAY , #COLOR_BayerGR2GRAY
  • Demosaicing using Variable Number of Gradients. #COLOR_BayerBG2BGR_VNG , #COLOR_BayerGB2BGR_VNG , #COLOR_BayerRG2BGR_VNG , #COLOR_BayerGR2BGR_VNG
  • Edge-Aware Demosaicing. #COLOR_BayerBG2BGR_EA , #COLOR_BayerGB2BGR_EA , #COLOR_BayerRG2BGR_EA , #COLOR_BayerGR2BGR_EA
  • Demosaicing with alpha channel #COLOR_BayerBG2BGRA , #COLOR_BayerGB2BGRA , #COLOR_BayerRG2BGRA , #COLOR_BayerGR2BGRA @sa cvtColor

Python prototype (for reference):

demosaicing(src, code[, dst[, dstCn]]) -> dst
Link to this function

demosaicing(src, code, opts)

View Source
Positional Arguments
  • src: UMat.
  • code: int.
Keyword Arguments
  • dst: UMat.
  • dstCn: int.

main function for all demosaicing processes

channels is derived automatically from src and code.

The function can do the following transformations:

  • Demosaicing using bilinear interpolation #COLOR_BayerBG2BGR , #COLOR_BayerGB2BGR , #COLOR_BayerRG2BGR , #COLOR_BayerGR2BGR #COLOR_BayerBG2GRAY , #COLOR_BayerGB2GRAY , #COLOR_BayerRG2GRAY , #COLOR_BayerGR2GRAY
  • Demosaicing using Variable Number of Gradients. #COLOR_BayerBG2BGR_VNG , #COLOR_BayerGB2BGR_VNG , #COLOR_BayerRG2BGR_VNG , #COLOR_BayerGR2BGR_VNG
  • Edge-Aware Demosaicing. #COLOR_BayerBG2BGR_EA , #COLOR_BayerGB2BGR_EA , #COLOR_BayerRG2BGR_EA , #COLOR_BayerGR2BGR_EA
  • Demosaicing with alpha channel #COLOR_BayerBG2BGRA , #COLOR_BayerGB2BGRA , #COLOR_BayerRG2BGRA , #COLOR_BayerGR2BGRA @sa cvtColor

Python prototype (for reference):

demosaicing(src, code[, dst[, dstCn]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • sigma_s: float.
  • sigma_r: float.

This filter enhances the details of a particular image.

Python prototype (for reference):

detailEnhance(src[, dst[, sigma_s[, sigma_r]]]) -> dst
Link to this function

detailEnhance(src, opts)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • sigma_s: float.
  • sigma_r: float.

This filter enhances the details of a particular image.

Python prototype (for reference):

detailEnhance(src[, dst[, sigma_s[, sigma_r]]]) -> dst

Returns the determinant of a square floating-point matrix. The function cv::determinant calculates and returns the determinant of the specified matrix. For small matrices ( mtx.cols=mtx.rows\<=3 ), the direct method is used. For larger matrices, the function uses LU factorization with partial pivoting. For symmetric positively-determined matrices, it is also possible to use eigen decomposition to calculate the determinant.

square size.

@sa trace, invert, solve, eigen, @ref MatrixExpressions

Python prototype (for reference):

determinant(mtx) -> retval
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • nonzeroRows: int.

Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array. The function cv::dft performs one of the following:

  • Forward the Fourier transform of a 1D vector of N elements: \f[Y = F^{(N)} \cdot X,\f] where \f$F^{(N)}_{jk}=\exp(-2\pi i j k/N)\f$ and \f$i=\sqrt{-1}\f$
  • Inverse the Fourier transform of a 1D vector of N elements: \f[\begin{array}{l} X'= \left (F^{(N)} \right )^{-1} \cdot Y = \left (F^{(N)} \right )^* \cdot y \\ X = (1/N) \cdot X, \end{array}\f] where \f$F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T\f$
  • Forward the 2D Fourier transform of a M x N matrix: \f[Y = F^{(M)} \cdot X \cdot F^{(N)}\f]
  • Inverse the 2D Fourier transform of a M x N matrix: \f[\begin{array}{l} X'= \left (F^{(M)} \right )^* \cdot Y \cdot \left (F^{(N)} \right )^* \\ X = \frac{1}{M \cdot N} \cdot X' \end{array}\f] In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input spectrum of the inverse Fourier transform can be represented in a packed format called CCS (complex-conjugate-symmetrical). It was borrowed from IPL (Intel* Image Processing Library). Here is how 2D CCS spectrum looks: \f[\begin{bmatrix} Re Y_{0,0} & Re Y_{0,1} & Im Y_{0,1} & Re Y_{0,2} & Im Y_{0,2} & \cdots & Re Y_{0,N/2-1} & Im Y_{0,N/2-1} & Re Y_{0,N/2} \\ Re Y_{1,0} & Re Y_{1,1} & Im Y_{1,1} & Re Y_{1,2} & Im Y_{1,2} & \cdots & Re Y_{1,N/2-1} & Im Y_{1,N/2-1} & Re Y_{1,N/2} \\ Im Y_{1,0} & Re Y_{2,1} & Im Y_{2,1} & Re Y_{2,2} & Im Y_{2,2} & \cdots & Re Y_{2,N/2-1} & Im Y_{2,N/2-1} & Im Y_{1,N/2} \\ \hdotsfor{9} \\ Re Y_{M/2-1,0} & Re Y_{M-3,1} & Im Y_{M-3,1} & \hdotsfor{3} & Re Y_{M-3,N/2-1} & Im Y_{M-3,N/2-1}& Re Y_{M/2-1,N/2} \\ Im Y_{M/2-1,0} & Re Y_{M-2,1} & Im Y_{M-2,1} & \hdotsfor{3} & Re Y_{M-2,N/2-1} & Im Y_{M-2,N/2-1}& Im Y_{M/2-1,N/2} \\ Re Y_{M/2,0} & Re Y_{M-1,1} & Im Y_{M-1,1} & \hdotsfor{3} & Re Y_{M-1,N/2-1} & Im Y_{M-1,N/2-1}& Re Y_{M/2,N/2} \end{bmatrix}\f] In case of 1D transform of a real vector, the output looks like the first row of the matrix above. So, the function chooses an operation mode depending on the flags and size of the input array:
  • If #DFT_ROWS is set or the input array has a single row or single column, the function performs a 1D forward or inverse transform of each row of a matrix when #DFT_ROWS is set. Otherwise, it performs a 2D transform.
  • If the input array is real and #DFT_INVERSE is not set, the function performs a forward 1D or 2D transform:
  • When #DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as input.
  • When #DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as input. In case of 2D transform, it uses the packed format as shown above. In case of a single 1D transform, it looks like the first row of the matrix above. In case of multiple 1D transforms (when using the #DFT_ROWS flag), each row of the output matrix looks like the first row of the matrix above.
  • If the input array is complex and either #DFT_INVERSE or #DFT_REAL_OUTPUT are not set, the output is a complex array of the same size as input. The function performs a forward or inverse 1D or 2D transform of the whole input array or each row of the input array independently, depending on the flags DFT_INVERSE and DFT_ROWS.
  • When #DFT_INVERSE is set and the input array is real, or it is complex but #DFT_REAL_OUTPUT is set, the output is a real array of the same size as input. The function performs a 1D or 2D inverse transformation of the whole input array or each individual row, depending on the flags #DFT_INVERSE and #DFT_ROWS. If #DFT_SCALE is set, the scaling is done after the transformation. Unlike dct , the function supports arrays of arbitrary size. But only those arrays are processed efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the current implementation). Such an efficient DFT size can be calculated using the getOptimalDFTSize method. The sample below illustrates how to calculate a DFT-based convolution of two 2D real arrays:
    void convolveDFT(InputArray A, InputArray B, OutputArray C)
    {
    // reallocate the output array if needed
    C.create(abs(A.rows - B.rows)+1, abs(A.cols - B.cols)+1, A.type());
    Size dftSize;
    // calculate the size of DFT transform
    dftSize.width = getOptimalDFTSize(A.cols + B.cols - 1);
    dftSize.height = getOptimalDFTSize(A.rows + B.rows - 1);
    // allocate temporary buffers and initialize them with 0's
    Mat tempA(dftSize, A.type(), Scalar::all(0));
    Mat tempB(dftSize, B.type(), Scalar::all(0));
    // copy A and B to the top-left corners of tempA and tempB, respectively
    Mat roiA(tempA, Rect(0,0,A.cols,A.rows));
    A.copyTo(roiA);
    Mat roiB(tempB, Rect(0,0,B.cols,B.rows));
    B.copyTo(roiB);
    // now transform the padded A & B in-place;
    // use "nonzeroRows" hint for faster processing
    dft(tempA, tempA, 0, A.rows);
    dft(tempB, tempB, 0, B.rows);
    // multiply the spectrums;
    // the function handles packed spectrum representations well
    mulSpectrums(tempA, tempB, tempA);
    // transform the product back from the frequency domain.
    // Even though all the result rows will be non-zero,
    // you need only the first C.rows of them, and thus you
    // pass nonzeroRows == C.rows
    dft(tempA, tempA, DFT_INVERSE + DFT_SCALE, C.rows);
    // now copy the result back to C.
    tempA(Rect(0, 0, C.cols, C.rows)).copyTo(C);
    // all the temporary buffers will be deallocated automatically
    }
    To optimize this sample, consider the following approaches:
  • Since nonzeroRows != 0 is passed to the forward transform calls and since A and B are copied to the top-left corners of tempA and tempB, respectively, it is not necessary to clear the whole tempA and tempB. It is only necessary to clear the tempA.cols - A.cols ( tempB.cols - B.cols) rightmost columns of the matrices.
  • This DFT-based convolution does not have to be applied to the whole big arrays, especially if B is significantly smaller than A or vice versa. Instead, you can calculate convolution by parts. To do this, you need to split the output array C into multiple tiles. For each tile, estimate which parts of A and B are required to calculate convolution in this tile. If the tiles in C are too small, the speed will decrease a lot because of repeated work. In the ultimate case, when each tile in C is a single pixel, the algorithm becomes equivalent to the naive convolution algorithm. If the tiles are too big, the temporary arrays tempA and tempB become too big and there is also a slowdown because of bad cache locality. So, there is an optimal tile size somewhere in the middle.
  • If different tiles in C can be calculated in parallel and, thus, the convolution is done by parts, the loop can be threaded. All of the above improvements have been implemented in #matchTemplate and #filter2D . Therefore, by using them, you can get the performance even better than with the above theoretically optimal implementation. Though, those two functions actually calculate cross-correlation, not convolution, so you need to "flip" the second convolution operand B vertically and horizontally using flip . Note:
  • An example using the discrete fourier transform can be found at opencv_source_code/samples/cpp/dft.cpp
  • (Python) An example using the dft functionality to perform Wiener deconvolution can be found at opencv_source/samples/python/deconvolution.py
  • (Python) An example rearranging the quadrants of a Fourier image can be found at opencv_source/samples/python/dft.py nonzeroRows rows of the input array (#DFT_INVERSE is not set) or only the first nonzeroRows of the output array (#DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the rows more efficiently and save some time; this technique is very useful for calculating array cross-correlation or convolution using DFT. @sa dct , getOptimalDFTSize , mulSpectrums, filter2D , matchTemplate , flip , cartToPolar , magnitude , phase

Python prototype (for reference):

dft(src[, dst[, flags[, nonzeroRows]]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • nonzeroRows: int.

Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array. The function cv::dft performs one of the following:

  • Forward the Fourier transform of a 1D vector of N elements: \f[Y = F^{(N)} \cdot X,\f] where \f$F^{(N)}_{jk}=\exp(-2\pi i j k/N)\f$ and \f$i=\sqrt{-1}\f$
  • Inverse the Fourier transform of a 1D vector of N elements: \f[\begin{array}{l} X'= \left (F^{(N)} \right )^{-1} \cdot Y = \left (F^{(N)} \right )^* \cdot y \\ X = (1/N) \cdot X, \end{array}\f] where \f$F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T\f$
  • Forward the 2D Fourier transform of a M x N matrix: \f[Y = F^{(M)} \cdot X \cdot F^{(N)}\f]
  • Inverse the 2D Fourier transform of a M x N matrix: \f[\begin{array}{l} X'= \left (F^{(M)} \right )^* \cdot Y \cdot \left (F^{(N)} \right )^* \\ X = \frac{1}{M \cdot N} \cdot X' \end{array}\f] In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input spectrum of the inverse Fourier transform can be represented in a packed format called CCS (complex-conjugate-symmetrical). It was borrowed from IPL (Intel* Image Processing Library). Here is how 2D CCS spectrum looks: \f[\begin{bmatrix} Re Y_{0,0} & Re Y_{0,1} & Im Y_{0,1} & Re Y_{0,2} & Im Y_{0,2} & \cdots & Re Y_{0,N/2-1} & Im Y_{0,N/2-1} & Re Y_{0,N/2} \\ Re Y_{1,0} & Re Y_{1,1} & Im Y_{1,1} & Re Y_{1,2} & Im Y_{1,2} & \cdots & Re Y_{1,N/2-1} & Im Y_{1,N/2-1} & Re Y_{1,N/2} \\ Im Y_{1,0} & Re Y_{2,1} & Im Y_{2,1} & Re Y_{2,2} & Im Y_{2,2} & \cdots & Re Y_{2,N/2-1} & Im Y_{2,N/2-1} & Im Y_{1,N/2} \\ \hdotsfor{9} \\ Re Y_{M/2-1,0} & Re Y_{M-3,1} & Im Y_{M-3,1} & \hdotsfor{3} & Re Y_{M-3,N/2-1} & Im Y_{M-3,N/2-1}& Re Y_{M/2-1,N/2} \\ Im Y_{M/2-1,0} & Re Y_{M-2,1} & Im Y_{M-2,1} & \hdotsfor{3} & Re Y_{M-2,N/2-1} & Im Y_{M-2,N/2-1}& Im Y_{M/2-1,N/2} \\ Re Y_{M/2,0} & Re Y_{M-1,1} & Im Y_{M-1,1} & \hdotsfor{3} & Re Y_{M-1,N/2-1} & Im Y_{M-1,N/2-1}& Re Y_{M/2,N/2} \end{bmatrix}\f] In case of 1D transform of a real vector, the output looks like the first row of the matrix above. So, the function chooses an operation mode depending on the flags and size of the input array:
  • If #DFT_ROWS is set or the input array has a single row or single column, the function performs a 1D forward or inverse transform of each row of a matrix when #DFT_ROWS is set. Otherwise, it performs a 2D transform.
  • If the input array is real and #DFT_INVERSE is not set, the function performs a forward 1D or 2D transform:
  • When #DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as input.
  • When #DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as input. In case of 2D transform, it uses the packed format as shown above. In case of a single 1D transform, it looks like the first row of the matrix above. In case of multiple 1D transforms (when using the #DFT_ROWS flag), each row of the output matrix looks like the first row of the matrix above.
  • If the input array is complex and either #DFT_INVERSE or #DFT_REAL_OUTPUT are not set, the output is a complex array of the same size as input. The function performs a forward or inverse 1D or 2D transform of the whole input array or each row of the input array independently, depending on the flags DFT_INVERSE and DFT_ROWS.
  • When #DFT_INVERSE is set and the input array is real, or it is complex but #DFT_REAL_OUTPUT is set, the output is a real array of the same size as input. The function performs a 1D or 2D inverse transformation of the whole input array or each individual row, depending on the flags #DFT_INVERSE and #DFT_ROWS. If #DFT_SCALE is set, the scaling is done after the transformation. Unlike dct , the function supports arrays of arbitrary size. But only those arrays are processed efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the current implementation). Such an efficient DFT size can be calculated using the getOptimalDFTSize method. The sample below illustrates how to calculate a DFT-based convolution of two 2D real arrays:
    void convolveDFT(InputArray A, InputArray B, OutputArray C)
    {
    // reallocate the output array if needed
    C.create(abs(A.rows - B.rows)+1, abs(A.cols - B.cols)+1, A.type());
    Size dftSize;
    // calculate the size of DFT transform
    dftSize.width = getOptimalDFTSize(A.cols + B.cols - 1);
    dftSize.height = getOptimalDFTSize(A.rows + B.rows - 1);
    // allocate temporary buffers and initialize them with 0's
    Mat tempA(dftSize, A.type(), Scalar::all(0));
    Mat tempB(dftSize, B.type(), Scalar::all(0));
    // copy A and B to the top-left corners of tempA and tempB, respectively
    Mat roiA(tempA, Rect(0,0,A.cols,A.rows));
    A.copyTo(roiA);
    Mat roiB(tempB, Rect(0,0,B.cols,B.rows));
    B.copyTo(roiB);
    // now transform the padded A & B in-place;
    // use "nonzeroRows" hint for faster processing
    dft(tempA, tempA, 0, A.rows);
    dft(tempB, tempB, 0, B.rows);
    // multiply the spectrums;
    // the function handles packed spectrum representations well
    mulSpectrums(tempA, tempB, tempA);
    // transform the product back from the frequency domain.
    // Even though all the result rows will be non-zero,
    // you need only the first C.rows of them, and thus you
    // pass nonzeroRows == C.rows
    dft(tempA, tempA, DFT_INVERSE + DFT_SCALE, C.rows);
    // now copy the result back to C.
    tempA(Rect(0, 0, C.cols, C.rows)).copyTo(C);
    // all the temporary buffers will be deallocated automatically
    }
    To optimize this sample, consider the following approaches:
  • Since nonzeroRows != 0 is passed to the forward transform calls and since A and B are copied to the top-left corners of tempA and tempB, respectively, it is not necessary to clear the whole tempA and tempB. It is only necessary to clear the tempA.cols - A.cols ( tempB.cols - B.cols) rightmost columns of the matrices.
  • This DFT-based convolution does not have to be applied to the whole big arrays, especially if B is significantly smaller than A or vice versa. Instead, you can calculate convolution by parts. To do this, you need to split the output array C into multiple tiles. For each tile, estimate which parts of A and B are required to calculate convolution in this tile. If the tiles in C are too small, the speed will decrease a lot because of repeated work. In the ultimate case, when each tile in C is a single pixel, the algorithm becomes equivalent to the naive convolution algorithm. If the tiles are too big, the temporary arrays tempA and tempB become too big and there is also a slowdown because of bad cache locality. So, there is an optimal tile size somewhere in the middle.
  • If different tiles in C can be calculated in parallel and, thus, the convolution is done by parts, the loop can be threaded. All of the above improvements have been implemented in #matchTemplate and #filter2D . Therefore, by using them, you can get the performance even better than with the above theoretically optimal implementation. Though, those two functions actually calculate cross-correlation, not convolution, so you need to "flip" the second convolution operand B vertically and horizontally using flip . Note:
  • An example using the discrete fourier transform can be found at opencv_source_code/samples/cpp/dft.cpp
  • (Python) An example using the dft functionality to perform Wiener deconvolution can be found at opencv_source/samples/python/deconvolution.py
  • (Python) An example rearranging the quadrants of a Fourier image can be found at opencv_source/samples/python/dft.py nonzeroRows rows of the input array (#DFT_INVERSE is not set) or only the first nonzeroRows of the output array (#DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the rows more efficiently and save some time; this technique is very useful for calculating array cross-correlation or convolution using DFT. @sa dct , getOptimalDFTSize , mulSpectrums, filter2D , matchTemplate , flip , cartToPolar , magnitude , phase

Python prototype (for reference):

dft(src[, dst[, flags[, nonzeroRows]]]) -> dst
Positional Arguments
  • src: UMat.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • iterations: int.
  • borderType: int.
  • borderValue: Scalar.

Dilates an image by using a specific structuring element. The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken: \f[\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.

CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
structuring element is used. Kernel can be created using #getStructuringElement
anchor is at the element center.

@sa erode, morphologyEx, getStructuringElement

Python prototype (for reference):

dilate(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst
Link to this function

dilate(src, kernel, opts)

View Source
Positional Arguments
  • src: UMat.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • iterations: int.
  • borderType: int.
  • borderValue: Scalar.

Dilates an image by using a specific structuring element. The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken: \f[\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.

CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
structuring element is used. Kernel can be created using #getStructuringElement
anchor is at the element center.

@sa erode, morphologyEx, getStructuringElement

Python prototype (for reference):

dilate(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst
Link to this function

displayOverlay(winname, text)

View Source
Positional Arguments
  • winname: String.
  • text: String.
Keyword Arguments
  • delayms: int.

Displays a text on a window image as an overlay for a specified duration. The function displayOverlay displays useful information/tips on top of the window for a certain amount of time delayms. The function does not modify the image, displayed in the window, that is, after the specified delay the original content of the window is restored.

function is called before the previous overlay text timed out, the timer is restarted and the text
is updated. If this value is zero, the text never disappears.

Python prototype (for reference):

displayOverlay(winname, text[, delayms]) -> None
Link to this function

displayOverlay(winname, text, opts)

View Source
Positional Arguments
  • winname: String.
  • text: String.
Keyword Arguments
  • delayms: int.

Displays a text on a window image as an overlay for a specified duration. The function displayOverlay displays useful information/tips on top of the window for a certain amount of time delayms. The function does not modify the image, displayed in the window, that is, after the specified delay the original content of the window is restored.

function is called before the previous overlay text timed out, the timer is restarted and the text
is updated. If this value is zero, the text never disappears.

Python prototype (for reference):

displayOverlay(winname, text[, delayms]) -> None
Link to this function

displayStatusBar(winname, text)

View Source
Positional Arguments
  • winname: String.
  • text: String.
Keyword Arguments
  • delayms: int.

Displays a text on the window statusbar during the specified period of time. The function displayStatusBar displays useful information/tips on top of the window for a certain amount of time delayms . This information is displayed on the window statusbar (the window must be created with the CV_GUI_EXPANDED flags).

the previous text timed out, the timer is restarted and the text is updated. If this value is
zero, the text never disappears.

Python prototype (for reference):

displayStatusBar(winname, text[, delayms]) -> None
Link to this function

displayStatusBar(winname, text, opts)

View Source
Positional Arguments
  • winname: String.
  • text: String.
Keyword Arguments
  • delayms: int.

Displays a text on the window statusbar during the specified period of time. The function displayStatusBar displays useful information/tips on top of the window for a certain amount of time delayms . This information is displayed on the window statusbar (the window must be created with the CV_GUI_EXPANDED flags).

the previous text timed out, the timer is restarted and the text is updated. If this value is
zero, the text never disappears.

Python prototype (for reference):

displayStatusBar(winname, text[, delayms]) -> None
Link to this function

distanceTransform(src, distanceType, maskSize)

View Source
Positional Arguments
  • src: UMat.
  • distanceType: int.
  • maskSize: int.
Keyword Arguments
  • dst: UMat.
  • dstType: int.

Has overloading in C++

single-channel image of the same size as src .
#DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a \f$3\times 3\f$ mask gives
the same result as \f$5\times 5\f$ or any larger aperture.
the first variant of the function and distanceType == #DIST_L1.

Python prototype (for reference):

distanceTransform(src, distanceType, maskSize[, dst[, dstType]]) -> dst
Link to this function

distanceTransform(src, distanceType, maskSize, opts)

View Source
Positional Arguments
  • src: UMat.
  • distanceType: int.
  • maskSize: int.
Keyword Arguments
  • dst: UMat.
  • dstType: int.

Has overloading in C++

single-channel image of the same size as src .
#DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a \f$3\times 3\f$ mask gives
the same result as \f$5\times 5\f$ or any larger aperture.
the first variant of the function and distanceType == #DIST_L1.

Python prototype (for reference):

distanceTransform(src, distanceType, maskSize[, dst[, dstType]]) -> dst
Link to this function

distanceTransformWithLabels(src, distanceType, maskSize)

View Source
Positional Arguments
  • src: UMat.
  • distanceType: int.
  • maskSize: int.
Keyword Arguments
  • dst: UMat.
  • labels: UMat.
  • labelType: int.

Calculates the distance to the closest zero pixel for each pixel of the source image. The function cv::distanceTransform calculates the approximate or precise distance from every binary image pixel to the nearest zero pixel. For zero image pixels, the distance will obviously be zero. When maskSize == #DIST_MASK_PRECISE and distanceType == #DIST_L2 , the function runs the algorithm described in @cite Felzenszwalb04 . This algorithm is parallelized with the TBB library. In other cases, the algorithm @cite Borgefors86 is used. This means that for a pixel the function finds the shortest path to the nearest zero pixel consisting of basic shifts: horizontal, vertical, diagonal, or knight's move (the latest is available for a \f$5\times 5\f$ mask). The overall distance is calculated as a sum of these basic distances. Since the distance function should be symmetric, all of the horizontal and vertical shifts must have the same cost (denoted as a ), all the diagonal shifts must have the same cost (denoted as b), and all knight's moves must have the same cost (denoted as c). For the #DIST_C and #DIST_L1 types, the distance is calculated precisely, whereas for #DIST_L2 (Euclidean distance) the distance can be calculated only with a relative error (a \f$5\times 5\f$ mask gives more accurate results). For a,b, and c, OpenCV uses the values suggested in the original paper:

  • DIST_L1: a = 1, b = 2
  • DIST_L2:
  • 3 x 3: a=0.955, b=1.3693
  • 5 x 5: a=1, b=1.4, c=2.1969
  • DIST_C: a = 1, b = 1 Typically, for a fast, coarse distance estimation #DIST_L2, a \f$3\times 3\f$ mask is used. For a more accurate distance estimation #DIST_L2, a \f$5\times 5\f$ mask or the precise algorithm is used. Note that both the precise and the approximate algorithms are linear on the number of pixels. This variant of the function does not only compute the minimum distance for each pixel \f$(x, y)\f$ but also identifies the nearest connected component consisting of zero pixels (labelType==#DIST_LABEL_CCOMP) or the nearest zero pixel (labelType==#DIST_LABEL_PIXEL). Index of the component/pixel is stored in labels(x, y). When labelType==#DIST_LABEL_CCOMP, the function automatically finds connected components of zero pixels in the input image and marks them with distinct labels. When labelType==#DIST_LABEL_PIXEL, the function scans through the input image and marks all the zero pixels with distinct labels. In this mode, the complexity is still linear. That is, the function provides a very fast way to compute the Voronoi diagram for a binary image. Currently, the second variant can use only the approximate distance transform algorithm, i.e. maskSize=#DIST_MASK_PRECISE is not supported yet. single-channel image of the same size as src. CV_32SC1 and the same size as src. #DIST_MASK_PRECISE is not supported by this variant. In case of the #DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a \f$3\times 3\f$ mask gives the same result as \f$5\times 5\f$ or any larger aperture.

Python prototype (for reference):

distanceTransformWithLabels(src, distanceType, maskSize[, dst[, labels[, labelType]]]) -> dst, labels
Link to this function

distanceTransformWithLabels(src, distanceType, maskSize, opts)

View Source
Positional Arguments
  • src: UMat.
  • distanceType: int.
  • maskSize: int.
Keyword Arguments
  • dst: UMat.
  • labels: UMat.
  • labelType: int.

Calculates the distance to the closest zero pixel for each pixel of the source image. The function cv::distanceTransform calculates the approximate or precise distance from every binary image pixel to the nearest zero pixel. For zero image pixels, the distance will obviously be zero. When maskSize == #DIST_MASK_PRECISE and distanceType == #DIST_L2 , the function runs the algorithm described in @cite Felzenszwalb04 . This algorithm is parallelized with the TBB library. In other cases, the algorithm @cite Borgefors86 is used. This means that for a pixel the function finds the shortest path to the nearest zero pixel consisting of basic shifts: horizontal, vertical, diagonal, or knight's move (the latest is available for a \f$5\times 5\f$ mask). The overall distance is calculated as a sum of these basic distances. Since the distance function should be symmetric, all of the horizontal and vertical shifts must have the same cost (denoted as a ), all the diagonal shifts must have the same cost (denoted as b), and all knight's moves must have the same cost (denoted as c). For the #DIST_C and #DIST_L1 types, the distance is calculated precisely, whereas for #DIST_L2 (Euclidean distance) the distance can be calculated only with a relative error (a \f$5\times 5\f$ mask gives more accurate results). For a,b, and c, OpenCV uses the values suggested in the original paper:

  • DIST_L1: a = 1, b = 2
  • DIST_L2:
  • 3 x 3: a=0.955, b=1.3693
  • 5 x 5: a=1, b=1.4, c=2.1969
  • DIST_C: a = 1, b = 1 Typically, for a fast, coarse distance estimation #DIST_L2, a \f$3\times 3\f$ mask is used. For a more accurate distance estimation #DIST_L2, a \f$5\times 5\f$ mask or the precise algorithm is used. Note that both the precise and the approximate algorithms are linear on the number of pixels. This variant of the function does not only compute the minimum distance for each pixel \f$(x, y)\f$ but also identifies the nearest connected component consisting of zero pixels (labelType==#DIST_LABEL_CCOMP) or the nearest zero pixel (labelType==#DIST_LABEL_PIXEL). Index of the component/pixel is stored in labels(x, y). When labelType==#DIST_LABEL_CCOMP, the function automatically finds connected components of zero pixels in the input image and marks them with distinct labels. When labelType==#DIST_LABEL_PIXEL, the function scans through the input image and marks all the zero pixels with distinct labels. In this mode, the complexity is still linear. That is, the function provides a very fast way to compute the Voronoi diagram for a binary image. Currently, the second variant can use only the approximate distance transform algorithm, i.e. maskSize=#DIST_MASK_PRECISE is not supported yet. single-channel image of the same size as src. CV_32SC1 and the same size as src. #DIST_MASK_PRECISE is not supported by this variant. In case of the #DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a \f$3\times 3\f$ mask gives the same result as \f$5\times 5\f$ or any larger aperture.

Python prototype (for reference):

distanceTransformWithLabels(src, distanceType, maskSize[, dst[, labels[, labelType]]]) -> dst, labels

Variaint 1:

Positional Arguments
  • scale: double
  • src2: UMat
Keyword Arguments
  • dst: UMat.
  • dtype: int.

Has overloading in C++

Python prototype (for reference):

divide(scale, src2[, dst[, dtype]]) -> dst

Variaint 2:

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • scale: double.
  • dtype: int.

Performs per-element division of two arrays or a scalar by an array. The function cv::divide divides one array by another: \f[\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}\f] or a scalar by an array when there is no src1 : \f[\texttt{dst(I) = saturate(scale/src2(I))}\f] Different channels of multi-channel arrays are processed independently. For integer types when src2(I) is zero, dst(I) will also be zero. Note: In case of floating point data there is no special defined behavior for zero src2(I) values. Regular floating-point division is used. Expect correct IEEE-754 behaviour for floating-point data (with NaN, Inf result values). Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().

@sa multiply, add, subtract

Python prototype (for reference):

divide(src1, src2[, dst[, scale[, dtype]]]) -> dst
Link to this function

divide(scale, src2, opts)

View Source

Variaint 1:

Positional Arguments
  • scale: double
  • src2: UMat
Keyword Arguments
  • dst: UMat.
  • dtype: int.

Has overloading in C++

Python prototype (for reference):

divide(scale, src2[, dst[, dtype]]) -> dst

Variaint 2:

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • scale: double.
  • dtype: int.

Performs per-element division of two arrays or a scalar by an array. The function cv::divide divides one array by another: \f[\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}\f] or a scalar by an array when there is no src1 : \f[\texttt{dst(I) = saturate(scale/src2(I))}\f] Different channels of multi-channel arrays are processed independently. For integer types when src2(I) is zero, dst(I) will also be zero. Note: In case of floating point data there is no special defined behavior for zero src2(I) values. Regular floating-point division is used. Expect correct IEEE-754 behaviour for floating-point data (with NaN, Inf result values). Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow.

case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().

@sa multiply, add, subtract

Python prototype (for reference):

divide(src1, src2[, dst[, scale[, dtype]]]) -> dst
Link to this function

divSpectrums(a, b, flags)

View Source
Positional Arguments
  • a: UMat.
  • b: UMat.
  • flags: int.
Keyword Arguments
  • c: UMat.
  • conjB: bool.

Performs the per-element division of the first Fourier spectrum by the second Fourier spectrum. The function cv::divSpectrums performs the per-element division of the first array by the second array. The arrays are CCS-packed or complex matrices that are results of a real or complex Fourier transform.

each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a `0` as value.
or not (false).

Python prototype (for reference):

divSpectrums(a, b, flags[, c[, conjB]]) -> c
Link to this function

divSpectrums(a, b, flags, opts)

View Source
Positional Arguments
  • a: UMat.
  • b: UMat.
  • flags: int.
Keyword Arguments
  • c: UMat.
  • conjB: bool.

Performs the per-element division of the first Fourier spectrum by the second Fourier spectrum. The function cv::divSpectrums performs the per-element division of the first array by the second array. The arrays are CCS-packed or complex matrices that are results of a real or complex Fourier transform.

each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a `0` as value.
or not (false).

Python prototype (for reference):

divSpectrums(a, b, flags[, c[, conjB]]) -> c
Link to this function

drawChessboardCorners(image, patternSize, corners, patternWasFound)

View Source

Renders the detected chessboard corners.

(patternSize = cv::Size(points_per_row,points_per_column)).
return value of #findChessboardCorners should be passed here.

The function draws individual chessboard corners detected either as red circles if the board was not found, or as colored corners connected with lines if the board was found.

Python prototype (for reference):

drawChessboardCorners(image, patternSize, corners, patternWasFound) -> image
Link to this function

drawContours(image, contours, contourIdx, color)

View Source
Positional Arguments
  • image: UMat.
  • contours: vector_UMat.
  • contourIdx: int.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • hierarchy: UMat.
  • maxLevel: int.
  • offset: Point.

Draws contours outlines or filled contours. The function draws contour outlines in the image if \f$\texttt{thickness} \ge 0\f$ or fills the area bounded by the contours if \f$\texttt{thickness}<0\f$ . The example below shows how to retrieve connected components from the binary image and label them: : @include snippets/imgproc_drawContours.cpp

thickness=#FILLED ), the contour interiors are drawn.
some of the contours (see maxLevel ).
If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
parameter is only taken into account when there is hierarchy available.
\f$\texttt{offset}=(dx,dy)\f$ .

Note: When thickness=#FILLED, the function is designed to handle connected components with holes correctly even when no hierarchy data is provided. This is done by analyzing all the outlines together using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved contours. In order to solve this problem, you need to call #drawContours separately for each sub-group of contours, or iterate over the collection using contourIdx parameter.

Python prototype (for reference):

drawContours(image, contours, contourIdx, color[, thickness[, lineType[, hierarchy[, maxLevel[, offset]]]]]) -> image
Link to this function

drawContours(image, contours, contourIdx, color, opts)

View Source
Positional Arguments
  • image: UMat.
  • contours: vector_UMat.
  • contourIdx: int.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • hierarchy: UMat.
  • maxLevel: int.
  • offset: Point.

Draws contours outlines or filled contours. The function draws contour outlines in the image if \f$\texttt{thickness} \ge 0\f$ or fills the area bounded by the contours if \f$\texttt{thickness}<0\f$ . The example below shows how to retrieve connected components from the binary image and label them: : @include snippets/imgproc_drawContours.cpp

thickness=#FILLED ), the contour interiors are drawn.
some of the contours (see maxLevel ).
If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
parameter is only taken into account when there is hierarchy available.
\f$\texttt{offset}=(dx,dy)\f$ .

Note: When thickness=#FILLED, the function is designed to handle connected components with holes correctly even when no hierarchy data is provided. This is done by analyzing all the outlines together using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved contours. In order to solve this problem, you need to call #drawContours separately for each sub-group of contours, or iterate over the collection using contourIdx parameter.

Python prototype (for reference):

drawContours(image, contours, contourIdx, color[, thickness[, lineType[, hierarchy[, maxLevel[, offset]]]]]) -> image
Link to this function

drawFrameAxes(image, cameraMatrix, distCoeffs, rvec, tvec, length)

View Source
Positional Arguments
  • image: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • rvec: UMat.
  • tvec: UMat.
  • length: float.
Keyword Arguments
  • thickness: int.

Draw axes of the world/object coordinate system from pose estimation. @sa solvePnP

\f$\cameramatrix{A}\f$
\f$\distcoeffs\f$. If the vector is empty, the zero distortion coefficients are assumed.
the model coordinate system to the camera coordinate system.

This function draws the axes of the world/object coordinate system w.r.t. to the camera frame. OX is drawn in red, OY in green and OZ in blue.

Python prototype (for reference):

drawFrameAxes(image, cameraMatrix, distCoeffs, rvec, tvec, length[, thickness]) -> image
Link to this function

drawFrameAxes(image, cameraMatrix, distCoeffs, rvec, tvec, length, opts)

View Source
Positional Arguments
  • image: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • rvec: UMat.
  • tvec: UMat.
  • length: float.
Keyword Arguments
  • thickness: int.

Draw axes of the world/object coordinate system from pose estimation. @sa solvePnP

\f$\cameramatrix{A}\f$
\f$\distcoeffs\f$. If the vector is empty, the zero distortion coefficients are assumed.
the model coordinate system to the camera coordinate system.

This function draws the axes of the world/object coordinate system w.r.t. to the camera frame. OX is drawn in red, OY in green and OZ in blue.

Python prototype (for reference):

drawFrameAxes(image, cameraMatrix, distCoeffs, rvec, tvec, length[, thickness]) -> image
Link to this function

drawKeypoints(image, keypoints, outImage)

View Source
Positional Arguments
  • image: UMat.
  • keypoints: vector_KeyPoint.
  • outImage: UMat.
Keyword Arguments
  • color: Scalar.
  • flags: DrawMatchesFlags.

Draws keypoints.

output image. See possible flags bit values below.
DrawMatchesFlags. See details above in drawMatches .

Note: For Python API, flags are modified as cv.DRAW_MATCHES_FLAGS_DEFAULT, cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG, cv.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS

Python prototype (for reference):

drawKeypoints(image, keypoints, outImage[, color[, flags]]) -> outImage
Link to this function

drawKeypoints(image, keypoints, outImage, opts)

View Source
Positional Arguments
  • image: UMat.
  • keypoints: vector_KeyPoint.
  • outImage: UMat.
Keyword Arguments
  • color: Scalar.
  • flags: DrawMatchesFlags.

Draws keypoints.

output image. See possible flags bit values below.
DrawMatchesFlags. See details above in drawMatches .

Note: For Python API, flags are modified as cv.DRAW_MATCHES_FLAGS_DEFAULT, cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG, cv.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS

Python prototype (for reference):

drawKeypoints(image, keypoints, outImage[, color[, flags]]) -> outImage
Link to this function

drawMarker(img, position, color)

View Source
Positional Arguments
  • img: UMat. Image.
  • position: Point.
  • color: Scalar.
Keyword Arguments
  • markerType: int.
  • markerSize: int.
  • thickness: int.
  • line_type: int.

Draws a marker on a predefined position in an image. The function cv::drawMarker draws a marker on a given position in the image. For the moment several marker types are supported, see #MarkerTypes for more information.

Python prototype (for reference):

drawMarker(img, position, color[, markerType[, markerSize[, thickness[, line_type]]]]) -> img
Link to this function

drawMarker(img, position, color, opts)

View Source
Positional Arguments
  • img: UMat. Image.
  • position: Point.
  • color: Scalar.
Keyword Arguments
  • markerType: int.
  • markerSize: int.
  • thickness: int.
  • line_type: int.

Draws a marker on a predefined position in an image. The function cv::drawMarker draws a marker on a given position in the image. For the moment several marker types are supported, see #MarkerTypes for more information.

Python prototype (for reference):

drawMarker(img, position, color[, markerType[, markerSize[, thickness[, line_type]]]]) -> img
Link to this function

drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg)

View Source
Positional Arguments
  • img1: UMat.
  • keypoints1: vector_KeyPoint.
  • img2: UMat.
  • keypoints2: vector_KeyPoint.
  • matches1to2: vector_DMatch.
  • outImg: UMat.
Keyword Arguments
  • matchColor: Scalar.
  • singlePointColor: Scalar.
  • matchesMask: vector_char.
  • flags: DrawMatchesFlags.

Draws the found matches of keypoints from two images.

has a corresponding point in keypoints2[matches[i]] .
output image. See possible flags bit values below.
, the color is generated randomly.
have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
drawn.
DrawMatchesFlags.

This function draws matches of keypoints from two images in the output image. Match is a line connecting two keypoints (circles). See cv::DrawMatchesFlags.

Python prototype (for reference):

drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg
Link to this function

drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg, opts)

View Source

Variaint 1:

Positional Arguments
  • img1: UMat
  • keypoints1: vector_KeyPoint
  • img2: UMat
  • keypoints2: vector_KeyPoint
  • matches1to2: vector_DMatch
  • outImg: UMat
  • matchesThickness: int
Keyword Arguments
  • matchColor: Scalar.
  • singlePointColor: Scalar.
  • matchesMask: vector_char.
  • flags: DrawMatchesFlags.

Has overloading in C++

Python prototype (for reference):

drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchesThickness[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg

Variaint 2:

Positional Arguments
  • img1: UMat.
  • keypoints1: vector_KeyPoint.
  • img2: UMat.
  • keypoints2: vector_KeyPoint.
  • matches1to2: vector_DMatch.
  • outImg: UMat.
Keyword Arguments
  • matchColor: Scalar.
  • singlePointColor: Scalar.
  • matchesMask: vector_char.
  • flags: DrawMatchesFlags.

Draws the found matches of keypoints from two images.

has a corresponding point in keypoints2[matches[i]] .
output image. See possible flags bit values below.
, the color is generated randomly.
have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
drawn.
DrawMatchesFlags.

This function draws matches of keypoints from two images in the output image. Match is a line connecting two keypoints (circles). See cv::DrawMatchesFlags.

Python prototype (for reference):

drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg
Link to this function

drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchesThickness, opts)

View Source
Positional Arguments
  • img1: UMat
  • keypoints1: vector_KeyPoint
  • img2: UMat
  • keypoints2: vector_KeyPoint
  • matches1to2: vector_DMatch
  • outImg: UMat
  • matchesThickness: int
Keyword Arguments
  • matchColor: Scalar.
  • singlePointColor: Scalar.
  • matchesMask: vector_char.
  • flags: DrawMatchesFlags.

Has overloading in C++

Python prototype (for reference):

drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchesThickness[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg
Link to this function

drawMatchesKnn(img1, keypoints1, img2, keypoints2, matches1to2, outImg)

View Source
Positional Arguments
  • img1: UMat
  • keypoints1: vector_KeyPoint
  • img2: UMat
  • keypoints2: vector_KeyPoint
  • matches1to2: vector_vector_DMatch
  • outImg: UMat
Keyword Arguments
  • matchColor: Scalar.
  • singlePointColor: Scalar.
  • matchesMask: vector_vector_char.
  • flags: DrawMatchesFlags.

Python prototype (for reference):

drawMatchesKnn(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg
Link to this function

drawMatchesKnn(img1, keypoints1, img2, keypoints2, matches1to2, outImg, opts)

View Source
Positional Arguments
  • img1: UMat
  • keypoints1: vector_KeyPoint
  • img2: UMat
  • keypoints2: vector_KeyPoint
  • matches1to2: vector_vector_DMatch
  • outImg: UMat
Keyword Arguments
  • matchColor: Scalar.
  • singlePointColor: Scalar.
  • matchesMask: vector_vector_char.
  • flags: DrawMatchesFlags.

Python prototype (for reference):

drawMatchesKnn(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg
Link to this function

edgePreservingFilter(src)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • sigma_s: float.
  • sigma_r: float.

Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing filters are used in many different applications @cite EM11 .

Python prototype (for reference):

edgePreservingFilter(src[, dst[, flags[, sigma_s[, sigma_r]]]]) -> dst
Link to this function

edgePreservingFilter(src, opts)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • sigma_s: float.
  • sigma_r: float.

Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing filters are used in many different applications @cite EM11 .

Python prototype (for reference):

edgePreservingFilter(src[, dst[, flags[, sigma_s[, sigma_r]]]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • eigenvalues: UMat.
  • eigenvectors: UMat.

Calculates eigenvalues and eigenvectors of a symmetric matrix. The function cv::eigen calculates just eigenvalues, or eigenvalues and eigenvectors of the symmetric matrix src:

src*eigenvectors.row(i).t() = eigenvalues.at<srcType>(i)*eigenvectors.row(i).t()

Note: Use cv::eigenNonSymmetric for calculation of real eigenvalues and eigenvectors of non-symmetric matrix.

(src ^T^ == src).
in the descending order.
eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding
eigenvalues.

@sa eigenNonSymmetric, completeSymm , PCA

Python prototype (for reference):

eigen(src[, eigenvalues[, eigenvectors]]) -> retval, eigenvalues, eigenvectors
Positional Arguments
  • src: UMat.
Keyword Arguments
  • eigenvalues: UMat.
  • eigenvectors: UMat.

Calculates eigenvalues and eigenvectors of a symmetric matrix. The function cv::eigen calculates just eigenvalues, or eigenvalues and eigenvectors of the symmetric matrix src:

src*eigenvectors.row(i).t() = eigenvalues.at<srcType>(i)*eigenvectors.row(i).t()

Note: Use cv::eigenNonSymmetric for calculation of real eigenvalues and eigenvectors of non-symmetric matrix.

(src ^T^ == src).
in the descending order.
eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding
eigenvalues.

@sa eigenNonSymmetric, completeSymm , PCA

Python prototype (for reference):

eigen(src[, eigenvalues[, eigenvectors]]) -> retval, eigenvalues, eigenvectors
Positional Arguments
  • src: UMat.
Keyword Arguments
  • eigenvalues: UMat.
  • eigenvectors: UMat.

Calculates eigenvalues and eigenvectors of a non-symmetric matrix (real eigenvalues only). Note: Assumes real eigenvalues. The function calculates eigenvalues and eigenvectors (optional) of the square matrix src:

src*eigenvectors.row(i).t() = eigenvalues.at<srcType>(i)*eigenvectors.row(i).t()

@sa eigen

Python prototype (for reference):

eigenNonSymmetric(src[, eigenvalues[, eigenvectors]]) -> eigenvalues, eigenvectors
Link to this function

eigenNonSymmetric(src, opts)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • eigenvalues: UMat.
  • eigenvectors: UMat.

Calculates eigenvalues and eigenvectors of a non-symmetric matrix (real eigenvalues only). Note: Assumes real eigenvalues. The function calculates eigenvalues and eigenvectors (optional) of the square matrix src:

src*eigenvectors.row(i).t() = eigenvalues.at<srcType>(i)*eigenvectors.row(i).t()

@sa eigen

Python prototype (for reference):

eigenNonSymmetric(src[, eigenvalues[, eigenvectors]]) -> eigenvalues, eigenvectors
Link to this function

ellipse2Poly(center, axes, angle, arcStart, arcEnd, delta)

View Source

Approximates an elliptic arc with a polyline. The function ellipse2Poly computes the vertices of a polyline that approximates the specified elliptic arc. It is used by #ellipse. If arcStart is greater than arcEnd, they are swapped.

accuracy.

Python prototype (for reference):

ellipse2Poly(center, axes, angle, arcStart, arcEnd, delta) -> pts
Link to this function

ellipse(img, box, color)

View Source
Positional Arguments
  • img: UMat. Image.
  • box: RotatedRect.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.

Has overloading in C++

an ellipse inscribed in the rotated rectangle.
a filled ellipse sector is to be drawn.

Python prototype (for reference):

ellipse(img, box, color[, thickness[, lineType]]) -> img
Link to this function

ellipse(img, box, color, opts)

View Source
Positional Arguments
  • img: UMat. Image.
  • box: RotatedRect.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.

Has overloading in C++

an ellipse inscribed in the rotated rectangle.
a filled ellipse sector is to be drawn.

Python prototype (for reference):

ellipse(img, box, color[, thickness[, lineType]]) -> img
Link to this function

ellipse(img, center, axes, angle, startAngle, endAngle, color)

View Source
Positional Arguments
  • img: UMat. Image.
  • center: Point.
  • axes: Size.
  • angle: double.
  • startAngle: double.
  • endAngle: double.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a simple or thick elliptic arc or fills an ellipse sector. The function cv::ellipse with more parameters draws an ellipse outline, a filled ellipse, an elliptic arc, or a filled ellipse sector. The drawing code uses general parametric form. A piecewise-linear curve is used to approximate the elliptic arc boundary. If you need more control of the ellipse rendering, you can retrieve the curve using #ellipse2Poly and then render it with #polylines or fill it with #fillPoly. If you use the first variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and endAngle=360. If startAngle is greater than endAngle, they are swapped. The figure below explains the meaning of the parameters to draw the blue arc. Parameters of Elliptic Arc

a filled ellipse sector is to be drawn.

Python prototype (for reference):

ellipse(img, center, axes, angle, startAngle, endAngle, color[, thickness[, lineType[, shift]]]) -> img
Link to this function

ellipse(img, center, axes, angle, startAngle, endAngle, color, opts)

View Source
Positional Arguments
  • img: UMat. Image.
  • center: Point.
  • axes: Size.
  • angle: double.
  • startAngle: double.
  • endAngle: double.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a simple or thick elliptic arc or fills an ellipse sector. The function cv::ellipse with more parameters draws an ellipse outline, a filled ellipse, an elliptic arc, or a filled ellipse sector. The drawing code uses general parametric form. A piecewise-linear curve is used to approximate the elliptic arc boundary. If you need more control of the ellipse rendering, you can retrieve the curve using #ellipse2Poly and then render it with #polylines or fill it with #fillPoly. If you use the first variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and endAngle=360. If startAngle is greater than endAngle, they are swapped. The figure below explains the meaning of the parameters to draw the blue arc. Parameters of Elliptic Arc

a filled ellipse sector is to be drawn.

Python prototype (for reference):

ellipse(img, center, axes, angle, startAngle, endAngle, color[, thickness[, lineType[, shift]]]) -> img
Link to this function

emd(signature1, signature2, distType)

View Source
Positional Arguments
  • signature1: UMat.
  • signature2: UMat.
  • distType: int.
Keyword Arguments
  • cost: UMat.
  • lowerBound: Ptr<float>.
  • flow: UMat.

Computes the "minimal work" distance between two weighted point configurations. The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations. One of the applications described in @cite RubnerSept98, @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval. EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster. In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object.

Each row stores the point weight followed by the point coordinates. The matrix is allowed to have
a single column (weights only) if the user-defined cost matrix is used. The weights must be
non-negative and have at least one non-zero value.
may be different. The total weights may be different. In this case an extra "dummy" point is added
to either signature1 or signature2. The weights must be non-negative and have at least one non-zero
value.
is used, lower boundary lowerBound cannot be calculated because it needs a metric function.
signatures that is a distance between mass centers. The lower boundary may not be calculated if
the user-defined cost matrix is used, the total weights of point configurations are not equal, or
if the signatures consist of weights only (the signature matrices have a single column). You
*must** initialize \*lowerBound . If the calculated distance between mass centers is greater or
equal to \*lowerBound (it means that the signatures are far enough), the function does not
calculate EMD. In any case \*lowerBound is set to the calculated distance between mass centers on
return. Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound
should be set to 0.
a flow from \f$i\f$ -th point of signature1 to \f$j\f$ -th point of signature2 .

Python prototype (for reference):

EMD(signature1, signature2, distType[, cost[, lowerBound[, flow]]]) -> retval, lowerBound, flow
Link to this function

emd(signature1, signature2, distType, opts)

View Source
Positional Arguments
  • signature1: UMat.
  • signature2: UMat.
  • distType: int.
Keyword Arguments
  • cost: UMat.
  • lowerBound: Ptr<float>.
  • flow: UMat.

Computes the "minimal work" distance between two weighted point configurations. The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations. One of the applications described in @cite RubnerSept98, @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval. EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster. In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object.

Each row stores the point weight followed by the point coordinates. The matrix is allowed to have
a single column (weights only) if the user-defined cost matrix is used. The weights must be
non-negative and have at least one non-zero value.
may be different. The total weights may be different. In this case an extra "dummy" point is added
to either signature1 or signature2. The weights must be non-negative and have at least one non-zero
value.
is used, lower boundary lowerBound cannot be calculated because it needs a metric function.
signatures that is a distance between mass centers. The lower boundary may not be calculated if
the user-defined cost matrix is used, the total weights of point configurations are not equal, or
if the signatures consist of weights only (the signature matrices have a single column). You
*must** initialize \*lowerBound . If the calculated distance between mass centers is greater or
equal to \*lowerBound (it means that the signatures are far enough), the function does not
calculate EMD. In any case \*lowerBound is set to the calculated distance between mass centers on
return. Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound
should be set to 0.
a flow from \f$i\f$ -th point of signature1 to \f$j\f$ -th point of signature2 .

Python prototype (for reference):

EMD(signature1, signature2, distType[, cost[, lowerBound[, flow]]]) -> retval, lowerBound, flow
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Equalizes the histogram of a grayscale image. The function equalizes the histogram of the input image using the following algorithm:

  • Calculate the histogram \f$H\f$ for src .
  • Normalize the histogram so that the sum of histogram bins is 255.
  • Compute the integral of the histogram: \f[H'_i = \sum _{0 \le j < i} H(j)\f]
  • Transform the image using \f$H'\f$ as a look-up table: \f$\texttt{dst}(x,y) = H'(\texttt{src}(x,y))\f$ The algorithm normalizes the brightness and increases the contrast of the image.

Python prototype (for reference):

equalizeHist(src[, dst]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Equalizes the histogram of a grayscale image. The function equalizes the histogram of the input image using the following algorithm:

  • Calculate the histogram \f$H\f$ for src .
  • Normalize the histogram so that the sum of histogram bins is 255.
  • Compute the integral of the histogram: \f[H'_i = \sum _{0 \le j < i} H(j)\f]
  • Transform the image using \f$H'\f$ as a look-up table: \f$\texttt{dst}(x,y) = H'(\texttt{src}(x,y))\f$ The algorithm normalizes the brightness and increases the contrast of the image.

Python prototype (for reference):

equalizeHist(src[, dst]) -> dst
Positional Arguments
  • src: UMat.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • iterations: int.
  • borderType: int.
  • borderValue: Scalar.

Erodes an image by using a specific structuring element. The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken: \f[\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.

CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
structuring element is used. Kernel can be created using #getStructuringElement.
anchor is at the element center.

@sa dilate, morphologyEx, getStructuringElement

Python prototype (for reference):

erode(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst
Link to this function

erode(src, kernel, opts)

View Source
Positional Arguments
  • src: UMat.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • iterations: int.
  • borderType: int.
  • borderValue: Scalar.

Erodes an image by using a specific structuring element. The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken: \f[\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.

CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
structuring element is used. Kernel can be created using #getStructuringElement.
anchor is at the element center.

@sa dilate, morphologyEx, getStructuringElement

Python prototype (for reference):

erode(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst
Link to this function

estimateAffine2D(from, to)

View Source
Positional Arguments
  • from: UMat.
  • to: UMat.
Keyword Arguments
  • inliers: UMat.
  • method: int.
  • ransacReprojThreshold: double.
  • maxIters: size_t.
  • confidence: double.
  • refineIters: size_t.

Computes an optimal affine transformation between two 2D point sets. It computes \f[ \begin{bmatrix} x\\ y\\ \end{bmatrix} \begin{bmatrix} a_{11} & a_{12}\\ a_{21} & a_{22}\\ \end{bmatrix} \begin{bmatrix} X\\ Y\\ \end{bmatrix} + \begin{bmatrix} b_1\\ b_2\\ \end{bmatrix} \f]

-   @ref RANSAC - RANSAC-based robust method
-   @ref LMEDS - Least-Median robust method
RANSAC is the default method.
a point as an inlier. Applies only to RANSAC.
between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
Passing 0 will disable refining, so the output matrix will be output of robust method.

@return Output 2D affine transformation matrix \f$2 \times 3\f$ or empty matrix if transformation could not be estimated. The returned matrix has the following form: \f[ \begin{bmatrix} a_{11} & a_{12} & b_1\\ a_{21} & a_{22} & b_2\\ \end{bmatrix} \f] The function estimates an optimal 2D affine transformation between two 2D point sets using the selected robust algorithm. The computed transformation is then refined further (using only inliers) with the Levenberg-Marquardt method to reduce the re-projection error even more. Note: The RANSAC method can handle practically any ratio of outliers but needs a threshold to distinguish inliers from outliers. The method LMeDS does not need any threshold but it works correctly only when there are more than 50% of inliers. @sa estimateAffinePartial2D, getAffineTransform

Python prototype (for reference):

estimateAffine2D(from, to[, inliers[, method[, ransacReprojThreshold[, maxIters[, confidence[, refineIters]]]]]]) -> retval, inliers
Link to this function

estimateAffine2D(from, to, opts)

View Source

Variaint 1:

Positional Arguments
  • pts1: UMat
  • pts2: UMat
  • params: UsacParams
Keyword Arguments
  • inliers: UMat.

Python prototype (for reference):

estimateAffine2D(pts1, pts2, params[, inliers]) -> retval, inliers

Variaint 2:

Positional Arguments
  • from: UMat.
  • to: UMat.
Keyword Arguments
  • inliers: UMat.
  • method: int.
  • ransacReprojThreshold: double.
  • maxIters: size_t.
  • confidence: double.
  • refineIters: size_t.

Computes an optimal affine transformation between two 2D point sets. It computes \f[ \begin{bmatrix} x\\ y\\ \end{bmatrix} \begin{bmatrix} a_{11} & a_{12}\\ a_{21} & a_{22}\\ \end{bmatrix} \begin{bmatrix} X\\ Y\\ \end{bmatrix} + \begin{bmatrix} b_1\\ b_2\\ \end{bmatrix} \f]

-   @ref RANSAC - RANSAC-based robust method
-   @ref LMEDS - Least-Median robust method
RANSAC is the default method.
a point as an inlier. Applies only to RANSAC.
between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
Passing 0 will disable refining, so the output matrix will be output of robust method.

@return Output 2D affine transformation matrix \f$2 \times 3\f$ or empty matrix if transformation could not be estimated. The returned matrix has the following form: \f[ \begin{bmatrix} a_{11} & a_{12} & b_1\\ a_{21} & a_{22} & b_2\\ \end{bmatrix} \f] The function estimates an optimal 2D affine transformation between two 2D point sets using the selected robust algorithm. The computed transformation is then refined further (using only inliers) with the Levenberg-Marquardt method to reduce the re-projection error even more. Note: The RANSAC method can handle practically any ratio of outliers but needs a threshold to distinguish inliers from outliers. The method LMeDS does not need any threshold but it works correctly only when there are more than 50% of inliers. @sa estimateAffinePartial2D, getAffineTransform

Python prototype (for reference):

estimateAffine2D(from, to[, inliers[, method[, ransacReprojThreshold[, maxIters[, confidence[, refineIters]]]]]]) -> retval, inliers
Link to this function

estimateAffine2D(pts1, pts2, params, opts)

View Source
Positional Arguments
  • pts1: UMat
  • pts2: UMat
  • params: UsacParams
Keyword Arguments
  • inliers: UMat.

Python prototype (for reference):

estimateAffine2D(pts1, pts2, params[, inliers]) -> retval, inliers
Link to this function

estimateAffine3D(src, dst)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • force_rotation: bool.

Computes an optimal affine transformation between two 3D point sets. It computes \f$R,s,t\f$ minimizing \f$\sum{i} dst_i - c \cdot R \cdot src_i \f$ where \f$R\f$ is a 3x3 rotation matrix, \f$t\f$ is a 3x1 translation vector and \f$s\f$ is a scalar size value. This is an implementation of the algorithm by Umeyama \cite umeyama1991least . The estimated affine transform has a homogeneous scale which is a subclass of affine transformations with 7 degrees of freedom. The paired point sets need to comprise at least 3 points each.

Else the pointed-to variable will be set to the optimal scale.
This might be unwanted, e.g. when optimizing a transform between a right- and a
left-handed coordinate system.

@return 3D affine transformation matrix \f$3 \times 4\f$ of the form \f[T = \begin{bmatrix} R & t\\ \end{bmatrix} \f]

Python prototype (for reference):

estimateAffine3D(src, dst[, force_rotation]) -> retval, scale
Link to this function

estimateAffine3D(src, dst, opts)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • force_rotation: bool.

Computes an optimal affine transformation between two 3D point sets. It computes \f$R,s,t\f$ minimizing \f$\sum{i} dst_i - c \cdot R \cdot src_i \f$ where \f$R\f$ is a 3x3 rotation matrix, \f$t\f$ is a 3x1 translation vector and \f$s\f$ is a scalar size value. This is an implementation of the algorithm by Umeyama \cite umeyama1991least . The estimated affine transform has a homogeneous scale which is a subclass of affine transformations with 7 degrees of freedom. The paired point sets need to comprise at least 3 points each.

Else the pointed-to variable will be set to the optimal scale.
This might be unwanted, e.g. when optimizing a transform between a right- and a
left-handed coordinate system.

@return 3D affine transformation matrix \f$3 \times 4\f$ of the form \f[T = \begin{bmatrix} R & t\\ \end{bmatrix} \f]

Python prototype (for reference):

estimateAffine3D(src, dst[, force_rotation]) -> retval, scale
Link to this function

estimateAffinePartial2D(from, to)

View Source
Positional Arguments
  • from: UMat.
  • to: UMat.
Keyword Arguments
  • inliers: UMat.
  • method: int.
  • ransacReprojThreshold: double.
  • maxIters: size_t.
  • confidence: double.
  • refineIters: size_t.

Computes an optimal limited affine transformation with 4 degrees of freedom between two 2D point sets.

-   @ref RANSAC - RANSAC-based robust method
-   @ref LMEDS - Least-Median robust method
RANSAC is the default method.
a point as an inlier. Applies only to RANSAC.
between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
Passing 0 will disable refining, so the output matrix will be output of robust method.

@return Output 2D affine transformation (4 degrees of freedom) matrix \f$2 \times 3\f$ or empty matrix if transformation could not be estimated. The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust estimation. The computed transformation is then refined further (using only inliers) with the Levenberg-Marquardt method to reduce the re-projection error even more. Estimated transformation matrix is: \f[ \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\ \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y \end{bmatrix} \f] Where \f$ \theta \f$ is the rotation angle, \f$ s \f$ the scaling factor and \f$ t_x, t_y \f$ are translations in \f$ x, y \f$ axes respectively. Note: The RANSAC method can handle practically any ratio of outliers but need a threshold to distinguish inliers from outliers. The method LMeDS does not need any threshold but it works correctly only when there are more than 50% of inliers. @sa estimateAffine2D, getAffineTransform

Python prototype (for reference):

estimateAffinePartial2D(from, to[, inliers[, method[, ransacReprojThreshold[, maxIters[, confidence[, refineIters]]]]]]) -> retval, inliers
Link to this function

estimateAffinePartial2D(from, to, opts)

View Source
Positional Arguments
  • from: UMat.
  • to: UMat.
Keyword Arguments
  • inliers: UMat.
  • method: int.
  • ransacReprojThreshold: double.
  • maxIters: size_t.
  • confidence: double.
  • refineIters: size_t.

Computes an optimal limited affine transformation with 4 degrees of freedom between two 2D point sets.

-   @ref RANSAC - RANSAC-based robust method
-   @ref LMEDS - Least-Median robust method
RANSAC is the default method.
a point as an inlier. Applies only to RANSAC.
between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
Passing 0 will disable refining, so the output matrix will be output of robust method.

@return Output 2D affine transformation (4 degrees of freedom) matrix \f$2 \times 3\f$ or empty matrix if transformation could not be estimated. The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust estimation. The computed transformation is then refined further (using only inliers) with the Levenberg-Marquardt method to reduce the re-projection error even more. Estimated transformation matrix is: \f[ \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\ \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y \end{bmatrix} \f] Where \f$ \theta \f$ is the rotation angle, \f$ s \f$ the scaling factor and \f$ t_x, t_y \f$ are translations in \f$ x, y \f$ axes respectively. Note: The RANSAC method can handle practically any ratio of outliers but need a threshold to distinguish inliers from outliers. The method LMeDS does not need any threshold but it works correctly only when there are more than 50% of inliers. @sa estimateAffine2D, getAffineTransform

Python prototype (for reference):

estimateAffinePartial2D(from, to[, inliers[, method[, ransacReprojThreshold[, maxIters[, confidence[, refineIters]]]]]]) -> retval, inliers
Link to this function

estimateChessboardSharpness(image, patternSize, corners)

View Source
Positional Arguments
  • image: UMat.
  • patternSize: Size.
  • corners: UMat.
Keyword Arguments
  • rise_distance: float.
  • vertical: bool.
  • sharpness: UMat.

Estimates the sharpness of a detected chessboard. Image sharpness, as well as brightness, are a critical parameter for accuracte camera calibration. For accessing these parameters for filtering out problematic calibraiton images, this method calculates edge profiles by traveling from black to white chessboard cell centers. Based on this, the number of pixels is calculated required to transit from black to white. This width of the transition area is a good indication of how sharp the chessboard is imaged and should be below ~3.0 pixels. The optional sharpness array is of type CV_32FC1 and has for each calculated profile one row with the following five entries: 0 = x coordinate of the underlying edge in the image 1 = y coordinate of the underlying edge in the image 2 = width of the transition area (sharpness) 3 = signal strength in the black cell (min brightness) 4 = signal strength in the white cell (max brightness) @return Scalar(average sharpness, average min brightness, average max brightness,0)

Python prototype (for reference):

estimateChessboardSharpness(image, patternSize, corners[, rise_distance[, vertical[, sharpness]]]) -> retval, sharpness
Link to this function

estimateChessboardSharpness(image, patternSize, corners, opts)

View Source
Positional Arguments
  • image: UMat.
  • patternSize: Size.
  • corners: UMat.
Keyword Arguments
  • rise_distance: float.
  • vertical: bool.
  • sharpness: UMat.

Estimates the sharpness of a detected chessboard. Image sharpness, as well as brightness, are a critical parameter for accuracte camera calibration. For accessing these parameters for filtering out problematic calibraiton images, this method calculates edge profiles by traveling from black to white chessboard cell centers. Based on this, the number of pixels is calculated required to transit from black to white. This width of the transition area is a good indication of how sharp the chessboard is imaged and should be below ~3.0 pixels. The optional sharpness array is of type CV_32FC1 and has for each calculated profile one row with the following five entries: 0 = x coordinate of the underlying edge in the image 1 = y coordinate of the underlying edge in the image 2 = width of the transition area (sharpness) 3 = signal strength in the black cell (min brightness) 4 = signal strength in the white cell (max brightness) @return Scalar(average sharpness, average min brightness, average max brightness,0)

Python prototype (for reference):

estimateChessboardSharpness(image, patternSize, corners[, rise_distance[, vertical[, sharpness]]]) -> retval, sharpness
Link to this function

estimateTranslation3D(src, dst)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • out: UMat.
  • inliers: UMat.
  • ransacThreshold: double.
  • confidence: double.

Computes an optimal translation between two 3D point sets. It computes \f[ \begin{bmatrix} x\\ y\\ z\\ \end{bmatrix} \begin{bmatrix} X\\ Y\\ Z\\ \end{bmatrix} + \begin{bmatrix} b_1\\ b_2\\ b_3\\ \end{bmatrix} \f]

 \f[
 \begin{bmatrix}
 b\_1 \\\\
 b\_2 \\\\
 b\_3 \\\\
 \end{bmatrix}
 \f]
 an inlier.
 between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
 significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.

The function estimates an optimal 3D translation between two 3D point sets using the RANSAC algorithm.

Python prototype (for reference):

estimateTranslation3D(src, dst[, out[, inliers[, ransacThreshold[, confidence]]]]) -> retval, out, inliers
Link to this function

estimateTranslation3D(src, dst, opts)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • out: UMat.
  • inliers: UMat.
  • ransacThreshold: double.
  • confidence: double.

Computes an optimal translation between two 3D point sets. It computes \f[ \begin{bmatrix} x\\ y\\ z\\ \end{bmatrix} \begin{bmatrix} X\\ Y\\ Z\\ \end{bmatrix} + \begin{bmatrix} b_1\\ b_2\\ b_3\\ \end{bmatrix} \f]

 \f[
 \begin{bmatrix}
 b\_1 \\\\
 b\_2 \\\\
 b\_3 \\\\
 \end{bmatrix}
 \f]
 an inlier.
 between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
 significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.

The function estimates an optimal 3D translation between two 3D point sets using the RANSAC algorithm.

Python prototype (for reference):

estimateTranslation3D(src, dst[, out[, inliers[, ransacThreshold[, confidence]]]]) -> retval, out, inliers
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the exponent of every array element. The function cv::exp calculates the exponent of every element of the input array: \f[\texttt{dst} [I] = e^{ src(I) }\f] The maximum relative error is about 7e-6 for single-precision input and less than 1e-10 for double-precision input. Currently, the function converts denormalized values to zeros on output. Special values (NaN, Inf) are not handled. @sa log , cartToPolar , polarToCart , phase , pow , sqrt , magnitude

Python prototype (for reference):

exp(src[, dst]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the exponent of every array element. The function cv::exp calculates the exponent of every element of the input array: \f[\texttt{dst} [I] = e^{ src(I) }\f] The maximum relative error is about 7e-6 for single-precision input and less than 1e-10 for double-precision input. Currently, the function converts denormalized values to zeros on output. Special values (NaN, Inf) are not handled. @sa log , cartToPolar , polarToCart , phase , pow , sqrt , magnitude

Python prototype (for reference):

exp(src[, dst]) -> dst
Link to this function

extractChannel(src, coi)

View Source
Positional Arguments
  • src: UMat.
  • coi: int.
Keyword Arguments
  • dst: UMat.

Extracts a single channel from src (coi is 0-based index) @sa mixChannels, split

Python prototype (for reference):

extractChannel(src, coi[, dst]) -> dst
Link to this function

extractChannel(src, coi, opts)

View Source
Positional Arguments
  • src: UMat.
  • coi: int.
Keyword Arguments
  • dst: UMat.

Extracts a single channel from src (coi is 0-based index) @sa mixChannels, split

Python prototype (for reference):

extractChannel(src, coi[, dst]) -> dst

Calculates the angle of a 2D vector in degrees. The function fastAtan2 calculates the full-range angle of an input 2D vector. The angle is measured in degrees and varies from 0 to 360 degrees. The accuracy is about 0.3 degrees.

Python prototype (for reference):

fastAtan2(y, x) -> retval
Link to this function

fastNlMeansDenoising(src)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/ with several computational optimizations. Noise expected to be a gaussian white noise

Should be odd. Recommended value 7 pixels
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
removes image details, smaller h value preserves details but also preserves some noise

This function expected to be applied to grayscale images. For colored images look at fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting image to CIELAB colorspace and then separately denoise L and AB components with different h parameter.

Python prototype (for reference):

fastNlMeansDenoising(src[, dst[, h[, templateWindowSize[, searchWindowSize]]]]) -> dst
Link to this function

fastNlMeansDenoising(src, opts)

View Source

Variaint 1:

Positional Arguments
  • src: UMat.
  • h: vector_float.
Keyword Arguments
  • dst: UMat.
  • templateWindowSize: int.
  • searchWindowSize: int.
  • normType: int.

Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/ with several computational optimizations. Noise expected to be a gaussian white noise

2-channel, 3-channel or 4-channel image.
Should be odd. Recommended value 7 pixels
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
parameter applied to all channels or one per channel in dst. Big h value
perfectly removes noise but also removes image details, smaller h
value preserves details but also preserves some noise

This function expected to be applied to grayscale images. For colored images look at fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting image to CIELAB colorspace and then separately denoise L and AB components with different h parameter.

Python prototype (for reference):

fastNlMeansDenoising(src, h[, dst[, templateWindowSize[, searchWindowSize[, normType]]]]) -> dst

Variaint 2:

Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/ with several computational optimizations. Noise expected to be a gaussian white noise

Should be odd. Recommended value 7 pixels
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
removes image details, smaller h value preserves details but also preserves some noise

This function expected to be applied to grayscale images. For colored images look at fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting image to CIELAB colorspace and then separately denoise L and AB components with different h parameter.

Python prototype (for reference):

fastNlMeansDenoising(src[, dst[, h[, templateWindowSize[, searchWindowSize]]]]) -> dst
Link to this function

fastNlMeansDenoising(src, h, opts)

View Source
Positional Arguments
  • src: UMat.
  • h: vector_float.
Keyword Arguments
  • dst: UMat.
  • templateWindowSize: int.
  • searchWindowSize: int.
  • normType: int.

Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/ with several computational optimizations. Noise expected to be a gaussian white noise

2-channel, 3-channel or 4-channel image.
Should be odd. Recommended value 7 pixels
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
parameter applied to all channels or one per channel in dst. Big h value
perfectly removes noise but also removes image details, smaller h
value preserves details but also preserves some noise

This function expected to be applied to grayscale images. For colored images look at fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting image to CIELAB colorspace and then separately denoise L and AB components with different h parameter.

Python prototype (for reference):

fastNlMeansDenoising(src, h[, dst[, templateWindowSize[, searchWindowSize[, normType]]]]) -> dst
Link to this function

fastNlMeansDenoisingColored(src)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • hColor: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Modification of fastNlMeansDenoising function for colored images

Should be odd. Recommended value 7 pixels
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
removes noise but also removes image details, smaller h value preserves details but also preserves
some noise
will be enough to remove colored noise and do not distort colors

The function converts image to CIELAB colorspace and then separately denoise L and AB components with given h parameters using fastNlMeansDenoising function.

Python prototype (for reference):

fastNlMeansDenoisingColored(src[, dst[, h[, hColor[, templateWindowSize[, searchWindowSize]]]]]) -> dst
Link to this function

fastNlMeansDenoisingColored(src, opts)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • hColor: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Modification of fastNlMeansDenoising function for colored images

Should be odd. Recommended value 7 pixels
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
removes noise but also removes image details, smaller h value preserves details but also preserves
some noise
will be enough to remove colored noise and do not distort colors

The function converts image to CIELAB colorspace and then separately denoise L and AB components with given h parameters using fastNlMeansDenoising function.

Python prototype (for reference):

fastNlMeansDenoisingColored(src[, dst[, h[, hColor[, templateWindowSize[, searchWindowSize]]]]]) -> dst
Link to this function

fastNlMeansDenoisingColoredMulti(srcImgs, imgToDenoiseIndex, temporalWindowSize)

View Source
Positional Arguments
  • srcImgs: vector_UMat.
  • imgToDenoiseIndex: int.
  • temporalWindowSize: int.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • hColor: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Modification of fastNlMeansDenoisingMulti function for colored images sequences

size.
be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
srcImgs[imgToDenoiseIndex] image.
Should be odd. Recommended value 7 pixels
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
removes noise but also removes image details, smaller h value preserves details but also preserves
some noise.

The function converts images to CIELAB colorspace and then separately denoise L and AB components with given h parameters using fastNlMeansDenoisingMulti function.

Python prototype (for reference):

fastNlMeansDenoisingColoredMulti(srcImgs, imgToDenoiseIndex, temporalWindowSize[, dst[, h[, hColor[, templateWindowSize[, searchWindowSize]]]]]) -> dst
Link to this function

fastNlMeansDenoisingColoredMulti(srcImgs, imgToDenoiseIndex, temporalWindowSize, opts)

View Source
Positional Arguments
  • srcImgs: vector_UMat.
  • imgToDenoiseIndex: int.
  • temporalWindowSize: int.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • hColor: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Modification of fastNlMeansDenoisingMulti function for colored images sequences

size.
be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
srcImgs[imgToDenoiseIndex] image.
Should be odd. Recommended value 7 pixels
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
removes noise but also removes image details, smaller h value preserves details but also preserves
some noise.

The function converts images to CIELAB colorspace and then separately denoise L and AB components with given h parameters using fastNlMeansDenoisingMulti function.

Python prototype (for reference):

fastNlMeansDenoisingColoredMulti(srcImgs, imgToDenoiseIndex, temporalWindowSize[, dst[, h[, hColor[, templateWindowSize[, searchWindowSize]]]]]) -> dst
Link to this function

fastNlMeansDenoisingMulti(srcImgs, imgToDenoiseIndex, temporalWindowSize)

View Source
Positional Arguments
  • srcImgs: vector_UMat.
  • imgToDenoiseIndex: int.
  • temporalWindowSize: int.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Modification of fastNlMeansDenoising function for images sequence where consecutive images have been captured in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. For more details see http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394

4-channel images sequence. All images should have the same type and
size.
be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
srcImgs[imgToDenoiseIndex] image.
Should be odd. Recommended value 7 pixels
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
perfectly removes noise but also removes image details, smaller h
value preserves details but also preserves some noise

Python prototype (for reference):

fastNlMeansDenoisingMulti(srcImgs, imgToDenoiseIndex, temporalWindowSize[, dst[, h[, templateWindowSize[, searchWindowSize]]]]) -> dst
Link to this function

fastNlMeansDenoisingMulti(srcImgs, imgToDenoiseIndex, temporalWindowSize, opts)

View Source

Variaint 1:

Positional Arguments
  • srcImgs: vector_UMat.
  • imgToDenoiseIndex: int.
  • temporalWindowSize: int.
  • h: vector_float.
Keyword Arguments
  • dst: UMat.
  • templateWindowSize: int.
  • searchWindowSize: int.
  • normType: int.

Modification of fastNlMeansDenoising function for images sequence where consecutive images have been captured in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. For more details see http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394

2-channel, 3-channel or 4-channel images sequence. All images should
have the same type and size.
be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
srcImgs[imgToDenoiseIndex] image.
Should be odd. Recommended value 7 pixels
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
parameter applied to all channels or one per channel in dst. Big h value
perfectly removes noise but also removes image details, smaller h
value preserves details but also preserves some noise

Python prototype (for reference):

fastNlMeansDenoisingMulti(srcImgs, imgToDenoiseIndex, temporalWindowSize, h[, dst[, templateWindowSize[, searchWindowSize[, normType]]]]) -> dst

Variaint 2:

Positional Arguments
  • srcImgs: vector_UMat.
  • imgToDenoiseIndex: int.
  • temporalWindowSize: int.
Keyword Arguments
  • dst: UMat.
  • h: float.
  • templateWindowSize: int.
  • searchWindowSize: int.

Modification of fastNlMeansDenoising function for images sequence where consecutive images have been captured in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. For more details see http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394

4-channel images sequence. All images should have the same type and
size.
be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
srcImgs[imgToDenoiseIndex] image.
Should be odd. Recommended value 7 pixels
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
perfectly removes noise but also removes image details, smaller h
value preserves details but also preserves some noise

Python prototype (for reference):

fastNlMeansDenoisingMulti(srcImgs, imgToDenoiseIndex, temporalWindowSize[, dst[, h[, templateWindowSize[, searchWindowSize]]]]) -> dst
Link to this function

fastNlMeansDenoisingMulti(srcImgs, imgToDenoiseIndex, temporalWindowSize, h, opts)

View Source
Positional Arguments
  • srcImgs: vector_UMat.
  • imgToDenoiseIndex: int.
  • temporalWindowSize: int.
  • h: vector_float.
Keyword Arguments
  • dst: UMat.
  • templateWindowSize: int.
  • searchWindowSize: int.
  • normType: int.

Modification of fastNlMeansDenoising function for images sequence where consecutive images have been captured in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces. For more details see http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394

2-channel, 3-channel or 4-channel images sequence. All images should
have the same type and size.
be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
srcImgs[imgToDenoiseIndex] image.
Should be odd. Recommended value 7 pixels
given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
denoising time. Recommended value 21 pixels
parameter applied to all channels or one per channel in dst. Big h value
perfectly removes noise but also removes image details, smaller h
value preserves details but also preserves some noise

Python prototype (for reference):

fastNlMeansDenoisingMulti(srcImgs, imgToDenoiseIndex, temporalWindowSize, h[, dst[, templateWindowSize[, searchWindowSize[, normType]]]]) -> dst
Link to this function

fillConvexPoly(img, points, color)

View Source
Positional Arguments
  • img: UMat. Image.
  • points: UMat.
  • color: Scalar.
Keyword Arguments
  • lineType: int.
  • shift: int.

Fills a convex polygon. The function cv::fillConvexPoly draws a filled convex polygon. This function is much faster than the function #fillPoly . It can fill not only convex polygons but any monotonic polygon without self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line) twice at the most (though, its top-most and/or the bottom edge could be horizontal).

Python prototype (for reference):

fillConvexPoly(img, points, color[, lineType[, shift]]) -> img
Link to this function

fillConvexPoly(img, points, color, opts)

View Source
Positional Arguments
  • img: UMat. Image.
  • points: UMat.
  • color: Scalar.
Keyword Arguments
  • lineType: int.
  • shift: int.

Fills a convex polygon. The function cv::fillConvexPoly draws a filled convex polygon. This function is much faster than the function #fillPoly . It can fill not only convex polygons but any monotonic polygon without self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line) twice at the most (though, its top-most and/or the bottom edge could be horizontal).

Python prototype (for reference):

fillConvexPoly(img, points, color[, lineType[, shift]]) -> img
Link to this function

fillPoly(img, pts, color)

View Source
Positional Arguments
  • img: UMat. Image.
  • pts: vector_UMat.
  • color: Scalar.
Keyword Arguments
  • lineType: int.
  • shift: int.
  • offset: Point.

Fills the area bounded by one or more polygons. The function cv::fillPoly fills an area bounded by several polygonal contours. The function can fill complex areas, for example, areas with holes, contours with self-intersections (some of their parts), and so forth.

Python prototype (for reference):

fillPoly(img, pts, color[, lineType[, shift[, offset]]]) -> img
Link to this function

fillPoly(img, pts, color, opts)

View Source
Positional Arguments
  • img: UMat. Image.
  • pts: vector_UMat.
  • color: Scalar.
Keyword Arguments
  • lineType: int.
  • shift: int.
  • offset: Point.

Fills the area bounded by one or more polygons. The function cv::fillPoly fills an area bounded by several polygonal contours. The function can fill complex areas, for example, areas with holes, contours with self-intersections (some of their parts), and so forth.

Python prototype (for reference):

fillPoly(img, pts, color[, lineType[, shift[, offset]]]) -> img
Link to this function

filter2D(src, ddepth, kernel)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • delta: double.
  • borderType: int.

Convolves an image with the kernel. The function applies an arbitrary linear filter to an image. In-place operation is supported. When the aperture is partially outside the image, the function interpolates outlier pixel values according to the specified border mode. The function does actually compute correlation, not the convolution: \f[\texttt{dst} (x,y) = \sum _{ \substack{0\leq x' < \texttt{kernel.cols}\\{0\leq y' < \texttt{kernel.rows}}}} \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\f] That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip the kernel using #flip and set the new anchor to (kernel.cols - anchor.x - 1, kernel.rows - anchor.y - 1). The function uses the DFT-based algorithm in case of sufficiently large kernels (~11 x 11 or larger) and the direct algorithm for small kernels.

matrix; if you want to apply different kernels to different channels, split the image into
separate color planes using split and process them individually.
the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
is at the kernel center.

@sa sepFilter2D, dft, matchTemplate

Python prototype (for reference):

filter2D(src, ddepth, kernel[, dst[, anchor[, delta[, borderType]]]]) -> dst
Link to this function

filter2D(src, ddepth, kernel, opts)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • delta: double.
  • borderType: int.

Convolves an image with the kernel. The function applies an arbitrary linear filter to an image. In-place operation is supported. When the aperture is partially outside the image, the function interpolates outlier pixel values according to the specified border mode. The function does actually compute correlation, not the convolution: \f[\texttt{dst} (x,y) = \sum _{ \substack{0\leq x' < \texttt{kernel.cols}\\{0\leq y' < \texttt{kernel.rows}}}} \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\f] That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip the kernel using #flip and set the new anchor to (kernel.cols - anchor.x - 1, kernel.rows - anchor.y - 1). The function uses the DFT-based algorithm in case of sufficiently large kernels (~11 x 11 or larger) and the direct algorithm for small kernels.

matrix; if you want to apply different kernels to different channels, split the image into
separate color planes using split and process them individually.
the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
is at the kernel center.

@sa sepFilter2D, dft, matchTemplate

Python prototype (for reference):

filter2D(src, ddepth, kernel[, dst[, anchor[, delta[, borderType]]]]) -> dst
Link to this function

filterHomographyDecompByVisibleRefpoints(rotations, normals, beforePoints, afterPoints)

View Source
Positional Arguments
  • rotations: vector_UMat.
  • normals: vector_UMat.
  • beforePoints: UMat.
  • afterPoints: UMat.
Keyword Arguments
  • possibleSolutions: UMat.
  • pointsMask: UMat.

Filters homography decompositions based on additional information. This function is intended to filter the output of the #decomposeHomographyMat based on additional information as described in @cite Malis . The summary of the method: the #decomposeHomographyMat function returns 2 unique solutions and their "opposites" for a total of 4 solutions. If we have access to the sets of points visible in the camera frame before and after the homography transformation is applied, we can determine which are the true potential solutions and which are the opposites by verifying which homographies are consistent with all visible reference points being in front of the camera. The inputs are left unchanged; the filtered solution set is returned as indices into the existing one.

Python prototype (for reference):

filterHomographyDecompByVisibleRefpoints(rotations, normals, beforePoints, afterPoints[, possibleSolutions[, pointsMask]]) -> possibleSolutions
Link to this function

filterHomographyDecompByVisibleRefpoints(rotations, normals, beforePoints, afterPoints, opts)

View Source
Positional Arguments
  • rotations: vector_UMat.
  • normals: vector_UMat.
  • beforePoints: UMat.
  • afterPoints: UMat.
Keyword Arguments
  • possibleSolutions: UMat.
  • pointsMask: UMat.

Filters homography decompositions based on additional information. This function is intended to filter the output of the #decomposeHomographyMat based on additional information as described in @cite Malis . The summary of the method: the #decomposeHomographyMat function returns 2 unique solutions and their "opposites" for a total of 4 solutions. If we have access to the sets of points visible in the camera frame before and after the homography transformation is applied, we can determine which are the true potential solutions and which are the opposites by verifying which homographies are consistent with all visible reference points being in front of the camera. The inputs are left unchanged; the filtered solution set is returned as indices into the existing one.

Python prototype (for reference):

filterHomographyDecompByVisibleRefpoints(rotations, normals, beforePoints, afterPoints[, possibleSolutions[, pointsMask]]) -> possibleSolutions
Link to this function

filterSpeckles(img, newVal, maxSpeckleSize, maxDiff)

View Source
Positional Arguments
  • img: UMat.
  • newVal: double.
  • maxSpeckleSize: int.
  • maxDiff: double.
Keyword Arguments
  • buf: UMat.

Filters off small noise blobs (speckles) in the disparity map

affected by the algorithm
blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point
disparity map, where disparity values are multiplied by 16, this scale factor should be taken into
account when specifying this parameter value.

Python prototype (for reference):

filterSpeckles(img, newVal, maxSpeckleSize, maxDiff[, buf]) -> img, buf
Link to this function

filterSpeckles(img, newVal, maxSpeckleSize, maxDiff, opts)

View Source
Positional Arguments
  • img: UMat.
  • newVal: double.
  • maxSpeckleSize: int.
  • maxDiff: double.
Keyword Arguments
  • buf: UMat.

Filters off small noise blobs (speckles) in the disparity map

affected by the algorithm
blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point
disparity map, where disparity values are multiplied by 16, this scale factor should be taken into
account when specifying this parameter value.

Python prototype (for reference):

filterSpeckles(img, newVal, maxSpeckleSize, maxDiff[, buf]) -> img, buf
Link to this function

find4QuadCornerSubpix(img, corners, region_size)

View Source

Python prototype (for reference):

find4QuadCornerSubpix(img, corners, region_size) -> retval, corners
Link to this function

findChessboardCorners(image, patternSize)

View Source
Positional Arguments
  • image: UMat.
  • patternSize: Size.
Keyword Arguments
  • corners: UMat.
  • flags: int.

Finds the positions of internal corners of the chessboard.

( patternSize = cv::Size(points_per_row,points_per_colum) = cv::Size(columns,rows) ).
-   @ref CALIB_CB_ADAPTIVE_THRESH Use adaptive thresholding to convert the image to black
and white, rather than a fixed threshold level (computed from the average image brightness).
-   @ref CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with equalizeHist before
applying fixed or adaptive thresholding.
-   @ref CALIB_CB_FILTER_QUADS Use additional criteria (like contour area, perimeter,
square-like shape) to filter out false quads extracted at the contour retrieval stage.
-   @ref CALIB_CB_FAST_CHECK Run a fast check on the image that looks for chessboard corners,
and shortcut the call if none is found. This can drastically speed up the call in the
degenerate condition when no chessboard is observed.

The function attempts to determine whether the input image is a view of the chessboard pattern and locate the internal chessboard corners. The function returns a non-zero value if all of the corners are found and they are placed in a certain order (row by row, left to right in every row). Otherwise, if the function fails to find all the corners or reorder them, it returns 0. For example, a regular chessboard has 8 x 8 squares and 7 x 7 internal corners, that is, points where the black squares touch each other. The detected coordinates are approximate, and to determine their positions more accurately, the function calls cornerSubPix. You also may use the function cornerSubPix with different parameters if returned coordinates are not accurate enough. Sample usage of detecting and drawing chessboard corners: :

Size patternsize(8,6); //interior number of corners
Mat gray = ....; //source image
vector<Point2f> corners; //this will be filled by the detected corners
//CALIB_CB_FAST_CHECK saves a lot of time on images
//that do not contain any chessboard corners
bool patternfound = findChessboardCorners(gray, patternsize, corners,
CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE
+ CALIB_CB_FAST_CHECK);
if(patternfound)
cornerSubPix(gray, corners, Size(11, 11), Size(-1, -1),
TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));
drawChessboardCorners(img, patternsize, Mat(corners), patternfound);

Note: The function requires white space (like a square-thick border, the wider the better) around the board to make the detection more robust in various environments. Otherwise, if there is no border and the background is dark, the outer black squares cannot be segmented properly and so the square grouping and ordering algorithm fails. Use gen_pattern.py (@ref tutorial_camera_calibration_pattern) to create checkerboard.

Python prototype (for reference):

findChessboardCorners(image, patternSize[, corners[, flags]]) -> retval, corners
Link to this function

findChessboardCorners(image, patternSize, opts)

View Source
Positional Arguments
  • image: UMat.
  • patternSize: Size.
Keyword Arguments
  • corners: UMat.
  • flags: int.

Finds the positions of internal corners of the chessboard.

( patternSize = cv::Size(points_per_row,points_per_colum) = cv::Size(columns,rows) ).
-   @ref CALIB_CB_ADAPTIVE_THRESH Use adaptive thresholding to convert the image to black
and white, rather than a fixed threshold level (computed from the average image brightness).
-   @ref CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with equalizeHist before
applying fixed or adaptive thresholding.
-   @ref CALIB_CB_FILTER_QUADS Use additional criteria (like contour area, perimeter,
square-like shape) to filter out false quads extracted at the contour retrieval stage.
-   @ref CALIB_CB_FAST_CHECK Run a fast check on the image that looks for chessboard corners,
and shortcut the call if none is found. This can drastically speed up the call in the
degenerate condition when no chessboard is observed.

The function attempts to determine whether the input image is a view of the chessboard pattern and locate the internal chessboard corners. The function returns a non-zero value if all of the corners are found and they are placed in a certain order (row by row, left to right in every row). Otherwise, if the function fails to find all the corners or reorder them, it returns 0. For example, a regular chessboard has 8 x 8 squares and 7 x 7 internal corners, that is, points where the black squares touch each other. The detected coordinates are approximate, and to determine their positions more accurately, the function calls cornerSubPix. You also may use the function cornerSubPix with different parameters if returned coordinates are not accurate enough. Sample usage of detecting and drawing chessboard corners: :

Size patternsize(8,6); //interior number of corners
Mat gray = ....; //source image
vector<Point2f> corners; //this will be filled by the detected corners
//CALIB_CB_FAST_CHECK saves a lot of time on images
//that do not contain any chessboard corners
bool patternfound = findChessboardCorners(gray, patternsize, corners,
CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE
+ CALIB_CB_FAST_CHECK);
if(patternfound)
cornerSubPix(gray, corners, Size(11, 11), Size(-1, -1),
TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));
drawChessboardCorners(img, patternsize, Mat(corners), patternfound);

Note: The function requires white space (like a square-thick border, the wider the better) around the board to make the detection more robust in various environments. Otherwise, if there is no border and the background is dark, the outer black squares cannot be segmented properly and so the square grouping and ordering algorithm fails. Use gen_pattern.py (@ref tutorial_camera_calibration_pattern) to create checkerboard.

Python prototype (for reference):

findChessboardCorners(image, patternSize[, corners[, flags]]) -> retval, corners
Link to this function

findChessboardCornersSB(image, patternSize)

View Source
Positional Arguments
  • image: UMat
  • patternSize: Size
Keyword Arguments
  • corners: UMat.
  • flags: int.

Has overloading in C++

Python prototype (for reference):

findChessboardCornersSB(image, patternSize[, corners[, flags]]) -> retval, corners
Link to this function

findChessboardCornersSB(image, patternSize, opts)

View Source
Positional Arguments
  • image: UMat
  • patternSize: Size
Keyword Arguments
  • corners: UMat.
  • flags: int.

Has overloading in C++

Python prototype (for reference):

findChessboardCornersSB(image, patternSize[, corners[, flags]]) -> retval, corners
Link to this function

findChessboardCornersSBWithMeta(image, patternSize, flags)

View Source
Positional Arguments
  • image: UMat.
  • patternSize: Size.
  • flags: int.
Keyword Arguments
  • corners: UMat.
  • meta: UMat.

Finds the positions of internal corners of the chessboard using a sector based approach.

( patternSize = cv::Size(points_per_row,points_per_colum) = cv::Size(columns,rows) ).
-   @ref CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with equalizeHist before detection.
-   @ref CALIB_CB_EXHAUSTIVE Run an exhaustive search to improve detection rate.
-   @ref CALIB_CB_ACCURACY Up sample input image to improve sub-pixel accuracy due to aliasing effects.
-   @ref CALIB_CB_LARGER The detected pattern is allowed to be larger than patternSize (see description).
-   @ref CALIB_CB_MARKER The detected pattern must have a marker (see description).
This should be used if an accurate camera calibration is required.
Each entry stands for one corner of the pattern and can have one of the following values:
-   0 = no meta data attached
-   1 = left-top corner of a black cell
-   2 = left-top corner of a white cell
-   3 = left-top corner of a black cell with a white marker dot
-   4 = left-top corner of a white cell with a black marker dot (pattern origin in case of markers otherwise first corner)

The function is analog to #findChessboardCorners but uses a localized radon transformation approximated by box filters being more robust to all sort of noise, faster on larger images and is able to directly return the sub-pixel position of the internal chessboard corners. The Method is based on the paper @cite duda2018 "Accurate Detection and Localization of Checkerboard Corners for Calibration" demonstrating that the returned sub-pixel positions are more accurate than the one returned by cornerSubPix allowing a precise camera calibration for demanding applications. In the case, the flags @ref CALIB_CB_LARGER or @ref CALIB_CB_MARKER are given, the result can be recovered from the optional meta array. Both flags are helpful to use calibration patterns exceeding the field of view of the camera. These oversized patterns allow more accurate calibrations as corners can be utilized, which are as close as possible to the image borders. For a consistent coordinate system across all images, the optional marker (see image below) can be used to move the origin of the board to the location where the black circle is located. Note: The function requires a white boarder with roughly the same width as one of the checkerboard fields around the whole board to improve the detection in various environments. In addition, because of the localized radon transformation it is beneficial to use round corners for the field corners which are located on the outside of the board. The following figure illustrates a sample checkerboard optimized for the detection. However, any other checkerboard can be used as well. Use gen_pattern.py (@ref tutorial_camera_calibration_pattern) to create checkerboard. Checkerboard

Python prototype (for reference):

findChessboardCornersSBWithMeta(image, patternSize, flags[, corners[, meta]]) -> retval, corners, meta
Link to this function

findChessboardCornersSBWithMeta(image, patternSize, flags, opts)

View Source
Positional Arguments
  • image: UMat.
  • patternSize: Size.
  • flags: int.
Keyword Arguments
  • corners: UMat.
  • meta: UMat.

Finds the positions of internal corners of the chessboard using a sector based approach.

( patternSize = cv::Size(points_per_row,points_per_colum) = cv::Size(columns,rows) ).
-   @ref CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with equalizeHist before detection.
-   @ref CALIB_CB_EXHAUSTIVE Run an exhaustive search to improve detection rate.
-   @ref CALIB_CB_ACCURACY Up sample input image to improve sub-pixel accuracy due to aliasing effects.
-   @ref CALIB_CB_LARGER The detected pattern is allowed to be larger than patternSize (see description).
-   @ref CALIB_CB_MARKER The detected pattern must have a marker (see description).
This should be used if an accurate camera calibration is required.
Each entry stands for one corner of the pattern and can have one of the following values:
-   0 = no meta data attached
-   1 = left-top corner of a black cell
-   2 = left-top corner of a white cell
-   3 = left-top corner of a black cell with a white marker dot
-   4 = left-top corner of a white cell with a black marker dot (pattern origin in case of markers otherwise first corner)

The function is analog to #findChessboardCorners but uses a localized radon transformation approximated by box filters being more robust to all sort of noise, faster on larger images and is able to directly return the sub-pixel position of the internal chessboard corners. The Method is based on the paper @cite duda2018 "Accurate Detection and Localization of Checkerboard Corners for Calibration" demonstrating that the returned sub-pixel positions are more accurate than the one returned by cornerSubPix allowing a precise camera calibration for demanding applications. In the case, the flags @ref CALIB_CB_LARGER or @ref CALIB_CB_MARKER are given, the result can be recovered from the optional meta array. Both flags are helpful to use calibration patterns exceeding the field of view of the camera. These oversized patterns allow more accurate calibrations as corners can be utilized, which are as close as possible to the image borders. For a consistent coordinate system across all images, the optional marker (see image below) can be used to move the origin of the board to the location where the black circle is located. Note: The function requires a white boarder with roughly the same width as one of the checkerboard fields around the whole board to improve the detection in various environments. In addition, because of the localized radon transformation it is beneficial to use round corners for the field corners which are located on the outside of the board. The following figure illustrates a sample checkerboard optimized for the detection. However, any other checkerboard can be used as well. Use gen_pattern.py (@ref tutorial_camera_calibration_pattern) to create checkerboard. Checkerboard

Python prototype (for reference):

findChessboardCornersSBWithMeta(image, patternSize, flags[, corners[, meta]]) -> retval, corners, meta
Link to this function

findCirclesGrid(image, patternSize)

View Source
Positional Arguments
  • image: UMat
  • patternSize: Size
Keyword Arguments
  • centers: UMat.
  • flags: int.
  • blobDetector: Ptr<FeatureDetector>.

Has overloading in C++

Python prototype (for reference):

findCirclesGrid(image, patternSize[, centers[, flags[, blobDetector]]]) -> retval, centers
Link to this function

findCirclesGrid(image, patternSize, opts)

View Source
Positional Arguments
  • image: UMat
  • patternSize: Size
Keyword Arguments
  • centers: UMat.
  • flags: int.
  • blobDetector: Ptr<FeatureDetector>.

Has overloading in C++

Python prototype (for reference):

findCirclesGrid(image, patternSize[, centers[, flags[, blobDetector]]]) -> retval, centers
Link to this function

findCirclesGrid(image, patternSize, flags, blobDetector, parameters)

View Source
Positional Arguments
  • image: UMat.
  • patternSize: Size.
  • flags: int.
  • blobDetector: Ptr<FeatureDetector>.
  • parameters: CirclesGridFinderParameters.
Keyword Arguments
  • centers: UMat.

Finds centers in the grid of circles.

( patternSize = Size(points_per_row, points_per_colum) ).
-   @ref CALIB_CB_SYMMETRIC_GRID uses symmetric pattern of circles.
-   @ref CALIB_CB_ASYMMETRIC_GRID uses asymmetric pattern of circles.
-   @ref CALIB_CB_CLUSTERING uses a special algorithm for grid detection. It is more robust to
perspective distortions but much more sensitive to background clutter.
If `blobDetector` is NULL then `image` represents Point2f array of candidates.

The function attempts to determine whether the input image contains a grid of circles. If it is, the function locates centers of the circles. The function returns a non-zero value if all of the centers have been found and they have been placed in a certain order (row by row, left to right in every row). Otherwise, if the function fails to find all the corners or reorder them, it returns 0. Sample usage of detecting and drawing the centers of circles: :

Size patternsize(7,7); //number of centers
Mat gray = ...; //source image
vector<Point2f> centers; //this will be filled by the detected centers
bool patternfound = findCirclesGrid(gray, patternsize, centers);
drawChessboardCorners(img, patternsize, Mat(centers), patternfound);

Note: The function requires white space (like a square-thick border, the wider the better) around the board to make the detection more robust in various environments.

Python prototype (for reference):

findCirclesGrid(image, patternSize, flags, blobDetector, parameters[, centers]) -> retval, centers
Link to this function

findCirclesGrid(image, patternSize, flags, blobDetector, parameters, opts)

View Source
Positional Arguments
  • image: UMat.
  • patternSize: Size.
  • flags: int.
  • blobDetector: Ptr<FeatureDetector>.
  • parameters: CirclesGridFinderParameters.
Keyword Arguments
  • centers: UMat.

Finds centers in the grid of circles.

( patternSize = Size(points_per_row, points_per_colum) ).
-   @ref CALIB_CB_SYMMETRIC_GRID uses symmetric pattern of circles.
-   @ref CALIB_CB_ASYMMETRIC_GRID uses asymmetric pattern of circles.
-   @ref CALIB_CB_CLUSTERING uses a special algorithm for grid detection. It is more robust to
perspective distortions but much more sensitive to background clutter.
If `blobDetector` is NULL then `image` represents Point2f array of candidates.

The function attempts to determine whether the input image contains a grid of circles. If it is, the function locates centers of the circles. The function returns a non-zero value if all of the centers have been found and they have been placed in a certain order (row by row, left to right in every row). Otherwise, if the function fails to find all the corners or reorder them, it returns 0. Sample usage of detecting and drawing the centers of circles: :

Size patternsize(7,7); //number of centers
Mat gray = ...; //source image
vector<Point2f> centers; //this will be filled by the detected centers
bool patternfound = findCirclesGrid(gray, patternsize, centers);
drawChessboardCorners(img, patternsize, Mat(centers), patternfound);

Note: The function requires white space (like a square-thick border, the wider the better) around the board to make the detection more robust in various environments.

Python prototype (for reference):

findCirclesGrid(image, patternSize, flags, blobDetector, parameters[, centers]) -> retval, centers
Link to this function

findContours(image, mode, method)

View Source
Positional Arguments
  • image: UMat.
  • mode: int.
  • method: int.
Keyword Arguments
  • contours: vector_UMat.
  • hierarchy: UMat.
  • offset: Point.

Finds contours in a binary image. The function retrieves contours from the binary image using the algorithm @cite Suzuki85 . The contours are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the OpenCV sample directory. Note: Since opencv 3.2 source image is not modified by this function.

pixels remain 0's, so the image is treated as binary . You can use #compare, #inRange, #threshold ,
#adaptiveThreshold, #Canny, and others to create a binary image out of a grayscale or color one.
If mode equals to #RETR_CCOMP or #RETR_FLOODFILL, the input can also be a 32-bit integer image of labels (CV_32SC1).
std::vector<std::vector<cv::Point> >).
as many elements as the number of contours. For each i-th contour contours[i], the elements
hierarchy[i][0] , hierarchy[i][1] , hierarchy[i][2] , and hierarchy[i][3] are set to 0-based indices
in contours of the next and previous contours at the same hierarchical level, the first child
contour and the parent contour, respectively. If for the contour i there are no next, previous,
parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.

Note: In Python, hierarchy is nested inside a top level array. Use hierarchy[0][i] to access hierarchical elements of i-th contour.

contours are extracted from the image ROI and then they should be analyzed in the whole image
context.

Python prototype (for reference):

findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> contours, hierarchy
Link to this function

findContours(image, mode, method, opts)

View Source
Positional Arguments
  • image: UMat.
  • mode: int.
  • method: int.
Keyword Arguments
  • contours: vector_UMat.
  • hierarchy: UMat.
  • offset: Point.

Finds contours in a binary image. The function retrieves contours from the binary image using the algorithm @cite Suzuki85 . The contours are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the OpenCV sample directory. Note: Since opencv 3.2 source image is not modified by this function.

pixels remain 0's, so the image is treated as binary . You can use #compare, #inRange, #threshold ,
#adaptiveThreshold, #Canny, and others to create a binary image out of a grayscale or color one.
If mode equals to #RETR_CCOMP or #RETR_FLOODFILL, the input can also be a 32-bit integer image of labels (CV_32SC1).
std::vector<std::vector<cv::Point> >).
as many elements as the number of contours. For each i-th contour contours[i], the elements
hierarchy[i][0] , hierarchy[i][1] , hierarchy[i][2] , and hierarchy[i][3] are set to 0-based indices
in contours of the next and previous contours at the same hierarchical level, the first child
contour and the parent contour, respectively. If for the contour i there are no next, previous,
parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.

Note: In Python, hierarchy is nested inside a top level array. Use hierarchy[0][i] to access hierarchical elements of i-th contour.

contours are extracted from the image ROI and then they should be analyzed in the whole image
context.

Python prototype (for reference):

findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> contours, hierarchy
Link to this function

findEssentialMat(points1, points2)

View Source
Positional Arguments
  • points1: UMat.
  • points2: UMat.
Keyword Arguments
  • focal: double.
  • pp: Point2d.
  • method: int.
  • prob: double.
  • threshold: double.
  • maxIters: int.
  • mask: UMat.

Has overloading in C++

be floating-point (single or double precision).
are feature points from cameras with same focal length and principal point.
-   @ref RANSAC for the RANSAC algorithm.
-   @ref LMEDS for the LMedS algorithm.
line in pixels, beyond which the point is considered an outlier and is not used for computing the
final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
point localization, image resolution, and the image noise.
confidence (probability) that the estimated matrix is correct.
for the other points. The array is computed only in the RANSAC and LMedS methods.

This function differs from the one above that it computes camera intrinsic matrix from focal length and principal point: \f[A = \begin{bmatrix} f & 0 & x_{pp} \\ 0 & f & y_{pp} \\ 0 & 0 & 1 \end{bmatrix}\f]

Python prototype (for reference):

findEssentialMat(points1, points2[, focal[, pp[, method[, prob[, threshold[, maxIters[, mask]]]]]]]) -> retval, mask
Link to this function

findEssentialMat(points1, points2, opts)

View Source

Variaint 1:

Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix: UMat.
Keyword Arguments
  • method: int.
  • prob: double.
  • threshold: double.
  • maxIters: int.
  • mask: UMat.

Calculates an essential matrix from the corresponding points in two images.

be floating-point (single or double precision).
Note that this function assumes that points1 and points2 are feature points from cameras with the
same camera intrinsic matrix. If this assumption does not hold for your use case, use
#undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
passing these coordinates, pass the identity matrix for this parameter.
-   @ref RANSAC for the RANSAC algorithm.
-   @ref LMEDS for the LMedS algorithm.
confidence (probability) that the estimated matrix is correct.
line in pixels, beyond which the point is considered an outlier and is not used for computing the
final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
point localization, image resolution, and the image noise.
for the other points. The array is computed only in the RANSAC and LMedS methods.

This function estimates essential matrix based on the five-point algorithm solver in @cite Nister03 . @cite SteweniusCFS is also a related. The epipolar geometry is described by the following equation: \f[[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0\f] where \f$E\f$ is an essential matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding points in the first and the second images, respectively. The result of this function may be passed further to #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.

Python prototype (for reference):

findEssentialMat(points1, points2, cameraMatrix[, method[, prob[, threshold[, maxIters[, mask]]]]]) -> retval, mask

Variaint 2:

Positional Arguments
  • points1: UMat.
  • points2: UMat.
Keyword Arguments
  • focal: double.
  • pp: Point2d.
  • method: int.
  • prob: double.
  • threshold: double.
  • maxIters: int.
  • mask: UMat.

Has overloading in C++

be floating-point (single or double precision).
are feature points from cameras with same focal length and principal point.
-   @ref RANSAC for the RANSAC algorithm.
-   @ref LMEDS for the LMedS algorithm.
line in pixels, beyond which the point is considered an outlier and is not used for computing the
final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
point localization, image resolution, and the image noise.
confidence (probability) that the estimated matrix is correct.
for the other points. The array is computed only in the RANSAC and LMedS methods.

This function differs from the one above that it computes camera intrinsic matrix from focal length and principal point: \f[A = \begin{bmatrix} f & 0 & x_{pp} \\ 0 & f & y_{pp} \\ 0 & 0 & 1 \end{bmatrix}\f]

Python prototype (for reference):

findEssentialMat(points1, points2[, focal[, pp[, method[, prob[, threshold[, maxIters[, mask]]]]]]]) -> retval, mask
Link to this function

findEssentialMat(points1, points2, cameraMatrix, opts)

View Source
Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix: UMat.
Keyword Arguments
  • method: int.
  • prob: double.
  • threshold: double.
  • maxIters: int.
  • mask: UMat.

Calculates an essential matrix from the corresponding points in two images.

be floating-point (single or double precision).
Note that this function assumes that points1 and points2 are feature points from cameras with the
same camera intrinsic matrix. If this assumption does not hold for your use case, use
#undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
passing these coordinates, pass the identity matrix for this parameter.
-   @ref RANSAC for the RANSAC algorithm.
-   @ref LMEDS for the LMedS algorithm.
confidence (probability) that the estimated matrix is correct.
line in pixels, beyond which the point is considered an outlier and is not used for computing the
final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
point localization, image resolution, and the image noise.
for the other points. The array is computed only in the RANSAC and LMedS methods.

This function estimates essential matrix based on the five-point algorithm solver in @cite Nister03 . @cite SteweniusCFS is also a related. The epipolar geometry is described by the following equation: \f[[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0\f] where \f$E\f$ is an essential matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding points in the first and the second images, respectively. The result of this function may be passed further to #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.

Python prototype (for reference):

findEssentialMat(points1, points2, cameraMatrix[, method[, prob[, threshold[, maxIters[, mask]]]]]) -> retval, mask
Link to this function

findEssentialMat(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2)

View Source
Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
Keyword Arguments
  • method: int.
  • prob: double.
  • threshold: double.
  • mask: UMat.

Calculates an essential matrix from the corresponding points in two images from potentially two different cameras.

be floating-point (single or double precision).
Note that this function assumes that points1 and points2 are feature points from cameras with the
same camera matrix. If this assumption does not hold for your use case, use
#undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
to normalized image coordinates, which are valid for the identity camera matrix. When
passing these coordinates, pass the identity matrix for this parameter.
Note that this function assumes that points1 and points2 are feature points from cameras with the
same camera matrix. If this assumption does not hold for your use case, use
#undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
to normalized image coordinates, which are valid for the identity camera matrix. When
passing these coordinates, pass the identity matrix for this parameter.
\f$(k\_1, k\_2, p\_1, p\_2\[, k\_3\[, k\_4, k\_5, k\_6\[, s\_1, s\_2, s\_3, s\_4\[, \tau\_x, \tau\_y]]]])\f$
of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
\f$(k\_1, k\_2, p\_1, p\_2\[, k\_3\[, k\_4, k\_5, k\_6\[, s\_1, s\_2, s\_3, s\_4\[, \tau\_x, \tau\_y]]]])\f$
of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
-   @ref RANSAC for the RANSAC algorithm.
-   @ref LMEDS for the LMedS algorithm.
confidence (probability) that the estimated matrix is correct.
line in pixels, beyond which the point is considered an outlier and is not used for computing the
final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
point localization, image resolution, and the image noise.
for the other points. The array is computed only in the RANSAC and LMedS methods.

This function estimates essential matrix based on the five-point algorithm solver in @cite Nister03 . @cite SteweniusCFS is also a related. The epipolar geometry is described by the following equation: \f[[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0\f] where \f$E\f$ is an essential matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding points in the first and the second images, respectively. The result of this function may be passed further to #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.

Python prototype (for reference):

findEssentialMat(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2[, method[, prob[, threshold[, mask]]]]) -> retval, mask
Link to this function

findEssentialMat(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, opts)

View Source

Variaint 1:

Positional Arguments
  • points1: UMat
  • points2: UMat
  • cameraMatrix1: UMat
  • cameraMatrix2: UMat
  • dist_coeff1: UMat
  • dist_coeff2: UMat
  • params: UsacParams
Keyword Arguments
  • mask: UMat.

Python prototype (for reference):

findEssentialMat(points1, points2, cameraMatrix1, cameraMatrix2, dist_coeff1, dist_coeff2, params[, mask]) -> retval, mask

Variaint 2:

Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
Keyword Arguments
  • method: int.
  • prob: double.
  • threshold: double.
  • mask: UMat.

Calculates an essential matrix from the corresponding points in two images from potentially two different cameras.

be floating-point (single or double precision).
Note that this function assumes that points1 and points2 are feature points from cameras with the
same camera matrix. If this assumption does not hold for your use case, use
#undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
to normalized image coordinates, which are valid for the identity camera matrix. When
passing these coordinates, pass the identity matrix for this parameter.
Note that this function assumes that points1 and points2 are feature points from cameras with the
same camera matrix. If this assumption does not hold for your use case, use
#undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
to normalized image coordinates, which are valid for the identity camera matrix. When
passing these coordinates, pass the identity matrix for this parameter.
\f$(k\_1, k\_2, p\_1, p\_2\[, k\_3\[, k\_4, k\_5, k\_6\[, s\_1, s\_2, s\_3, s\_4\[, \tau\_x, \tau\_y]]]])\f$
of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
\f$(k\_1, k\_2, p\_1, p\_2\[, k\_3\[, k\_4, k\_5, k\_6\[, s\_1, s\_2, s\_3, s\_4\[, \tau\_x, \tau\_y]]]])\f$
of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
-   @ref RANSAC for the RANSAC algorithm.
-   @ref LMEDS for the LMedS algorithm.
confidence (probability) that the estimated matrix is correct.
line in pixels, beyond which the point is considered an outlier and is not used for computing the
final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
point localization, image resolution, and the image noise.
for the other points. The array is computed only in the RANSAC and LMedS methods.

This function estimates essential matrix based on the five-point algorithm solver in @cite Nister03 . @cite SteweniusCFS is also a related. The epipolar geometry is described by the following equation: \f[[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0\f] where \f$E\f$ is an essential matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding points in the first and the second images, respectively. The result of this function may be passed further to #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.

Python prototype (for reference):

findEssentialMat(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2[, method[, prob[, threshold[, mask]]]]) -> retval, mask
Link to this function

findEssentialMat(points1, points2, cameraMatrix1, cameraMatrix2, dist_coeff1, dist_coeff2, params, opts)

View Source
Positional Arguments
  • points1: UMat
  • points2: UMat
  • cameraMatrix1: UMat
  • cameraMatrix2: UMat
  • dist_coeff1: UMat
  • dist_coeff2: UMat
  • params: UsacParams
Keyword Arguments
  • mask: UMat.

Python prototype (for reference):

findEssentialMat(points1, points2, cameraMatrix1, cameraMatrix2, dist_coeff1, dist_coeff2, params[, mask]) -> retval, mask
Link to this function

findFundamentalMat(points1, points2)

View Source
Positional Arguments
  • points1: UMat
  • points2: UMat
Keyword Arguments
  • method: int.
  • ransacReprojThreshold: double.
  • confidence: double.
  • mask: UMat.

Has overloading in C++

Python prototype (for reference):

findFundamentalMat(points1, points2[, method[, ransacReprojThreshold[, confidence[, mask]]]]) -> retval, mask
Link to this function

findFundamentalMat(points1, points2, opts)

View Source

Variaint 1:

Positional Arguments
  • points1: UMat
  • points2: UMat
  • params: UsacParams
Keyword Arguments
  • mask: UMat.

Has overloading in C++

Python prototype (for reference):

findFundamentalMat(points1, points2, params[, mask]) -> retval, mask

Variaint 2:

Positional Arguments
  • points1: UMat
  • points2: UMat
Keyword Arguments
  • method: int.
  • ransacReprojThreshold: double.
  • confidence: double.
  • mask: UMat.

Has overloading in C++

Python prototype (for reference):

findFundamentalMat(points1, points2[, method[, ransacReprojThreshold[, confidence[, mask]]]]) -> retval, mask
Link to this function

findFundamentalMat(points1, points2, params, opts)

View Source
Positional Arguments
  • points1: UMat
  • points2: UMat
  • params: UsacParams
Keyword Arguments
  • mask: UMat.

Has overloading in C++

Python prototype (for reference):

findFundamentalMat(points1, points2, params[, mask]) -> retval, mask
Link to this function

findFundamentalMat(points1, points2, method, ransacReprojThreshold, confidence, maxIters)

View Source
Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • method: int.
  • ransacReprojThreshold: double.
  • confidence: double.
  • maxIters: int.
Keyword Arguments
  • mask: UMat.

Calculates a fundamental matrix from the corresponding points in two images.

floating-point (single or double precision).
-   @ref FM_7POINT for a 7-point algorithm. \f$N = 7\f$
-   @ref FM_8POINT for an 8-point algorithm. \f$N \ge 8\f$
-   @ref FM_RANSAC for the RANSAC algorithm. \f$N \ge 8\f$
-   @ref FM_LMEDS for the LMedS algorithm. \f$N \ge 8\f$
line in pixels, beyond which the point is considered an outlier and is not used for computing the
final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
point localization, image resolution, and the image noise.
of confidence (probability) that the estimated matrix is correct.

The epipolar geometry is described by the following equation: \f[[p_2; 1]^T F [p_1; 1] = 0\f] where \f$F\f$ is a fundamental matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding points in the first and the second images, respectively. The function calculates the fundamental matrix using one of four methods listed above and returns the found fundamental matrix. Normally just one matrix is found. But in case of the 7-point algorithm, the function may return up to 3 solutions ( \f$9 \times 3\f$ matrix that stores all 3 matrices sequentially). The calculated fundamental matrix may be passed further to computeCorrespondEpilines that finds the epipolar lines corresponding to the specified points. It can also be passed to #stereoRectifyUncalibrated to compute the rectification transformation. :

// Example. Estimation of fundamental matrix using the RANSAC algorithm
int point_count = 100;
vector<Point2f> points1(point_count);
vector<Point2f> points2(point_count);
// initialize the points here ...
for( int i = 0; i < point_count; i++ )
{
points1[i] = ...;
points2[i] = ...;
}
Mat fundamental_matrix =
findFundamentalMat(points1, points2, FM_RANSAC, 3, 0.99);

Python prototype (for reference):

findFundamentalMat(points1, points2, method, ransacReprojThreshold, confidence, maxIters[, mask]) -> retval, mask
Link to this function

findFundamentalMat(points1, points2, method, ransacReprojThreshold, confidence, maxIters, opts)

View Source
Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • method: int.
  • ransacReprojThreshold: double.
  • confidence: double.
  • maxIters: int.
Keyword Arguments
  • mask: UMat.

Calculates a fundamental matrix from the corresponding points in two images.

floating-point (single or double precision).
-   @ref FM_7POINT for a 7-point algorithm. \f$N = 7\f$
-   @ref FM_8POINT for an 8-point algorithm. \f$N \ge 8\f$
-   @ref FM_RANSAC for the RANSAC algorithm. \f$N \ge 8\f$
-   @ref FM_LMEDS for the LMedS algorithm. \f$N \ge 8\f$
line in pixels, beyond which the point is considered an outlier and is not used for computing the
final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
point localization, image resolution, and the image noise.
of confidence (probability) that the estimated matrix is correct.

The epipolar geometry is described by the following equation: \f[[p_2; 1]^T F [p_1; 1] = 0\f] where \f$F\f$ is a fundamental matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding points in the first and the second images, respectively. The function calculates the fundamental matrix using one of four methods listed above and returns the found fundamental matrix. Normally just one matrix is found. But in case of the 7-point algorithm, the function may return up to 3 solutions ( \f$9 \times 3\f$ matrix that stores all 3 matrices sequentially). The calculated fundamental matrix may be passed further to computeCorrespondEpilines that finds the epipolar lines corresponding to the specified points. It can also be passed to #stereoRectifyUncalibrated to compute the rectification transformation. :

// Example. Estimation of fundamental matrix using the RANSAC algorithm
int point_count = 100;
vector<Point2f> points1(point_count);
vector<Point2f> points2(point_count);
// initialize the points here ...
for( int i = 0; i < point_count; i++ )
{
points1[i] = ...;
points2[i] = ...;
}
Mat fundamental_matrix =
findFundamentalMat(points1, points2, FM_RANSAC, 3, 0.99);

Python prototype (for reference):

findFundamentalMat(points1, points2, method, ransacReprojThreshold, confidence, maxIters[, mask]) -> retval, mask
Link to this function

findHomography(srcPoints, dstPoints)

View Source
Positional Arguments
  • srcPoints: UMat.
  • dstPoints: UMat.
Keyword Arguments
  • method: int.
  • ransacReprojThreshold: double.
  • mask: UMat.
  • maxIters: int.
  • confidence: double.

Finds a perspective transformation between two planes.

or vector\<Point2f\> .
a vector\<Point2f\> .
-   **0** - a regular method using all the points, i.e., the least squares method
-   @ref RANSAC - RANSAC-based robust method
-   @ref LMEDS - Least-Median robust method
-   @ref RHO - PROSAC-based robust method
(used in the RANSAC and RHO methods only). That is, if
\f[\| \texttt{dstPoints} \_i -  \texttt{convertPointsHomogeneous} ( \texttt{H} \* \texttt{srcPoints} \_i) \|\_2  >  \texttt{ransacReprojThreshold}\f]
then the point \f$i\f$ is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
it usually makes sense to set this parameter somewhere in the range of 1 to 10.
mask values are ignored.

The function finds and returns the perspective transformation \f$H\f$ between the source and the destination planes: \f[s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\f] so that the back-projection error \f[\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2\f] is minimized. If the parameter method is set to the default value 0, the function uses all the point pairs to compute an initial homography estimate with a simple least-squares scheme. However, if not all of the point pairs ( \f$srcPoints_i\f$, \f$dstPoints_i\f$ ) fit the rigid perspective transformation (that is, there are some outliers), this initial estimate will be poor. In this case, you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the computed homography (which is the number of inliers for RANSAC or the least median re-projection error for LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and the mask of inliers/outliers. Regardless of the method, robust or not, the computed homography matrix is refined further (using inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the re-projection error even more. The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to distinguish inliers from outliers. The method LMeDS does not need any threshold but it works correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the noise is rather small, use the default method (method=0). The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is determined up to a scale. Thus, it is normalized so that \f$h_{33}=1\f$. Note that whenever an \f$H\f$ matrix cannot be estimated, an empty one will be returned. @sa getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective, perspectiveTransform

Python prototype (for reference):

findHomography(srcPoints, dstPoints[, method[, ransacReprojThreshold[, mask[, maxIters[, confidence]]]]]) -> retval, mask
Link to this function

findHomography(srcPoints, dstPoints, opts)

View Source

Variaint 1:

Positional Arguments
  • srcPoints: UMat
  • dstPoints: UMat
  • params: UsacParams
Keyword Arguments
  • mask: UMat.

Has overloading in C++

Python prototype (for reference):

findHomography(srcPoints, dstPoints, params[, mask]) -> retval, mask

Variaint 2:

Positional Arguments
  • srcPoints: UMat.
  • dstPoints: UMat.
Keyword Arguments
  • method: int.
  • ransacReprojThreshold: double.
  • mask: UMat.
  • maxIters: int.
  • confidence: double.

Finds a perspective transformation between two planes.

or vector\<Point2f\> .
a vector\<Point2f\> .
-   **0** - a regular method using all the points, i.e., the least squares method
-   @ref RANSAC - RANSAC-based robust method
-   @ref LMEDS - Least-Median robust method
-   @ref RHO - PROSAC-based robust method
(used in the RANSAC and RHO methods only). That is, if
\f[\| \texttt{dstPoints} \_i -  \texttt{convertPointsHomogeneous} ( \texttt{H} \* \texttt{srcPoints} \_i) \|\_2  >  \texttt{ransacReprojThreshold}\f]
then the point \f$i\f$ is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
it usually makes sense to set this parameter somewhere in the range of 1 to 10.
mask values are ignored.

The function finds and returns the perspective transformation \f$H\f$ between the source and the destination planes: \f[s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}\f] so that the back-projection error \f[\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2\f] is minimized. If the parameter method is set to the default value 0, the function uses all the point pairs to compute an initial homography estimate with a simple least-squares scheme. However, if not all of the point pairs ( \f$srcPoints_i\f$, \f$dstPoints_i\f$ ) fit the rigid perspective transformation (that is, there are some outliers), this initial estimate will be poor. In this case, you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the computed homography (which is the number of inliers for RANSAC or the least median re-projection error for LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and the mask of inliers/outliers. Regardless of the method, robust or not, the computed homography matrix is refined further (using inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the re-projection error even more. The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to distinguish inliers from outliers. The method LMeDS does not need any threshold but it works correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the noise is rather small, use the default method (method=0). The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is determined up to a scale. Thus, it is normalized so that \f$h_{33}=1\f$. Note that whenever an \f$H\f$ matrix cannot be estimated, an empty one will be returned. @sa getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective, perspectiveTransform

Python prototype (for reference):

findHomography(srcPoints, dstPoints[, method[, ransacReprojThreshold[, mask[, maxIters[, confidence]]]]]) -> retval, mask
Link to this function

findHomography(srcPoints, dstPoints, params, opts)

View Source
Positional Arguments
  • srcPoints: UMat
  • dstPoints: UMat
  • params: UsacParams
Keyword Arguments
  • mask: UMat.

Has overloading in C++

Python prototype (for reference):

findHomography(srcPoints, dstPoints, params[, mask]) -> retval, mask
Positional Arguments
  • src: UMat.
Keyword Arguments
  • idx: UMat.

Returns the list of locations of non-zero pixels Given a binary matrix (likely returned from an operation such as threshold(), compare(), >, ==, etc, return all of the non-zero indices as a cv::Mat or std::vector<cv::Point> (x,y) For example:

cv::Mat binaryImage; // input, binary image
cv::Mat locations;   // output, locations of non-zero pixels
cv::findNonZero(binaryImage, locations);
// access pixel coordinates
Point pnt = locations.at<Point>(i);

or

cv::Mat binaryImage; // input, binary image
vector<Point> locations;   // output, locations of non-zero pixels
cv::findNonZero(binaryImage, locations);
// access pixel coordinates
Point pnt = locations[i];

Python prototype (for reference):

findNonZero(src[, idx]) -> idx
Positional Arguments
  • src: UMat.
Keyword Arguments
  • idx: UMat.

Returns the list of locations of non-zero pixels Given a binary matrix (likely returned from an operation such as threshold(), compare(), >, ==, etc, return all of the non-zero indices as a cv::Mat or std::vector<cv::Point> (x,y) For example:

cv::Mat binaryImage; // input, binary image
cv::Mat locations;   // output, locations of non-zero pixels
cv::findNonZero(binaryImage, locations);
// access pixel coordinates
Point pnt = locations.at<Point>(i);

or

cv::Mat binaryImage; // input, binary image
vector<Point> locations;   // output, locations of non-zero pixels
cv::findNonZero(binaryImage, locations);
// access pixel coordinates
Point pnt = locations[i];

Python prototype (for reference):

findNonZero(src[, idx]) -> idx
Link to this function

findTransformECC(templateImage, inputImage, warpMatrix)

View Source
Positional Arguments
  • templateImage: UMat
  • inputImage: UMat
  • warpMatrix: UMat
Keyword Arguments
  • motionType: int.
  • criteria: TermCriteria.
  • inputMask: UMat.

Has overloading in C++

Python prototype (for reference):

findTransformECC(templateImage, inputImage, warpMatrix[, motionType[, criteria[, inputMask]]]) -> retval, warpMatrix
Link to this function

findTransformECC(templateImage, inputImage, warpMatrix, opts)

View Source
Positional Arguments
  • templateImage: UMat
  • inputImage: UMat
  • warpMatrix: UMat
Keyword Arguments
  • motionType: int.
  • criteria: TermCriteria.
  • inputMask: UMat.

Has overloading in C++

Python prototype (for reference):

findTransformECC(templateImage, inputImage, warpMatrix[, motionType[, criteria[, inputMask]]]) -> retval, warpMatrix
Link to this function

findTransformECC(templateImage, inputImage, warpMatrix, motionType, criteria, inputMask, gaussFiltSize)

View Source

Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 .

order to provide an image similar to templateImage, same type as templateImage.
-   **MOTION_TRANSLATION** sets a translational motion model; warpMatrix is \f$2\times 3\f$ with
the first \f$2\times 2\f$ part being the unity matrix and the rest two parameters being
estimated.
-   **MOTION_EUCLIDEAN** sets a Euclidean (rigid) transformation as motion model; three
parameters are estimated; warpMatrix is \f$2\times 3\f$.
-   **MOTION_AFFINE** sets an affine motion model (DEFAULT); six parameters are estimated;
warpMatrix is \f$2\times 3\f$.
-   **MOTION_HOMOGRAPHY** sets a homography as a motion model; eight parameters are
estimated;\`warpMatrix\` is \f$3\times 3\f$.
criteria.epsilon defines the threshold of the increment in the correlation coefficient between two
iterations (a negative criteria.epsilon makes criteria.maxcount the only termination criterion).
Default values are shown in the declaration above.

The function estimates the optimum transformation (warpMatrix) with respect to ECC criterion (@cite EP08), that is \f[\texttt{warpMatrix} = \arg\max_{W} \texttt{ECC}(\texttt{templateImage}(x,y),\texttt{inputImage}(x',y'))\f] where \f[\begin{bmatrix} x' \\ y' \end{bmatrix} = W \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}\f] (the equation holds with homogeneous coordinates for homography). It returns the final enhanced correlation coefficient, that is the correlation coefficient between the template image and the final warped input image. When a \f$3\times 3\f$ matrix is given with motionType =0, 1 or 2, the third row is ignored. Unlike findHomography and estimateRigidTransform, the function findTransformECC implements an area-based alignment that builds on intensity similarities. In essence, the function updates the initial transformation that roughly aligns the images. If this information is missing, the identity warp (unity matrix) is used as an initialization. Note that if images undergo strong displacements/rotations, an initial transformation that roughly aligns the images is necessary (e.g., a simple euclidean/similarity transform that allows for the images showing the same image content approximately). Use inverse warping in the second image to take an image close to the first one, i.e. use the flag WARP_INVERSE_MAP with warpAffine or warpPerspective. See also the OpenCV sample image_alignment.cpp that demonstrates the use of the function. Note that the function throws an exception if algorithm does not converges. @sa computeECC, estimateAffine2D, estimateAffinePartial2D, findHomography

Python prototype (for reference):

findTransformECC(templateImage, inputImage, warpMatrix, motionType, criteria, inputMask, gaussFiltSize) -> retval, warpMatrix

Fits an ellipse around a set of 2D points. The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of all. It returns the rotated rectangle in which the ellipse is inscribed. The first algorithm described by @cite Fitzgibbon95 is used. Developer should keep in mind that it is possible that the returned ellipse/rotatedRect data contains negative indices, due to the data points being close to the border of the containing Mat element.

Python prototype (for reference):

fitEllipse(points) -> retval

Fits an ellipse around a set of 2D points. The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle in which the ellipse is inscribed. The Approximate Mean Square (AMS) proposed by @cite Taubin1991 is used. For an ellipse, this basis set is \f$ \chi= \left(x^2, x y, y^2, x, y, 1\right) \f$, which is a set of six free coefficients \f$ A^T=\left\{A_{\text{xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\} \f$. However, to specify an ellipse, all that is needed is five numbers; the major and minor axes lengths \f$ (a,b) \f$, the position \f$ (x_0,y_0) \f$, and the orientation \f$ \theta \f$. This is because the basis set includes lines, quadratics, parabolic and hyperbolic functions as well as elliptical functions as possible fits. If the fit is found to be a parabolic or hyperbolic function then the standard #fitEllipse method is used. The AMS method restricts the fit to parabolic, hyperbolic and elliptical curves by imposing the condition that \f$ A^T ( D_x^T D_x + D_y^T D_y) A = 1 \f$ where the matrices \f$ Dx \f$ and \f$ Dy \f$ are the partial derivatives of the design matrix \f$ D \f$ with respect to x and y. The matrices are formed row by row applying the following to each of the points in the set: \f{align}{ D(i,:)&=\left{x_i^2, x_i y_i, y_i^2, x_i, y_i, 1\right} & D_x(i,:)&=\left{2 x_i,y_i,0,1,0,0\right} & D_y(i,:)&=\left{0,x_i,2 y_i,0,1,0\right} \f} The AMS method minimizes the cost function \f{equation}{ \epsilon ^2=\frac{ A^T D^T D A }{ A^T (D_x^T D_x + D_y^T D_y) A^T } \f} The minimum cost is found by solving the generalized eigenvalue problem. \f{equation*}{ D^T D A = \lambda \left( D_x^T D_x + D_y^T D_y\right) A \f}

Python prototype (for reference):

fitEllipseAMS(points) -> retval
Link to this function

fitEllipseDirect(points)

View Source

Fits an ellipse around a set of 2D points. The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle in which the ellipse is inscribed. The Direct least square (Direct) method by @cite Fitzgibbon1999 is used. For an ellipse, this basis set is \f$ \chi= \left(x^2, x y, y^2, x, y, 1\right) \f$, which is a set of six free coefficients \f$ A^T=\left\{A_{\text{xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\} \f$. However, to specify an ellipse, all that is needed is five numbers; the major and minor axes lengths \f$ (a,b) \f$, the position \f$ (x_0,y_0) \f$, and the orientation \f$ \theta \f$. This is because the basis set includes lines, quadratics, parabolic and hyperbolic functions as well as elliptical functions as possible fits. The Direct method confines the fit to ellipses by ensuring that \f$ 4 A_{xx} A_{yy}- A_{xy}^2 > 0 \f$. The condition imposed is that \f$ 4 A_{xx} A_{yy}- A_{xy}^2=1 \f$ which satisfies the inequality and as the coefficients can be arbitrarily scaled is not overly restrictive. \f{equation}{ \epsilon ^2= A^T D^T D A \quad \text{with} \quad A^T C A =1 \quad \text{and} \quad C=\left(\begin{matrix} 0 & 0 & 2 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 & 0 & 0 \\ 2 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \end{matrix} \right) \f} The minimum cost is found by solving the generalized eigenvalue problem. \f{equation}{ D^T D A = \lambda \left( C\right) A \f} The system produces only one positive eigenvalue \f$ \lambda\f$ which is chosen as the solution with its eigenvector \f$\mathbf{u}\f$. These are used to find the coefficients \f{equation*}{ A = \sqrt{\frac{1}{\mathbf{u}^T C \mathbf{u}}} \mathbf{u} \f} The scaling factor guarantees that \f$A^T C A =1\f$.

Python prototype (for reference):

fitEllipseDirect(points) -> retval
Link to this function

fitLine(points, distType, param, reps, aeps)

View Source
Positional Arguments
  • points: UMat.
  • distType: int.
  • param: double.
  • reps: double.
  • aeps: double.
Keyword Arguments
  • line: UMat.

Fits a line to a 2D or 3D point set. The function fitLine fits a line to a 2D or 3D point set by minimizing \f$\sum_i \rho(r_i)\f$ where \f$r_i\f$ is a distance between the \f$i^{th}\f$ point, the line and \f$\rho(r)\f$ is a distance function, one of the following:

  • DIST_L2 \f[\rho (r) = r^2/2 \quad \text{(the simplest and the fastest least-squares method)}\f]
  • DIST_L1 \f[\rho (r) = r\f]
  • DIST_L12 \f[\rho (r) = 2 \cdot ( \sqrt{1 + \frac{r^2}{2}} - 1)\f]
  • DIST_FAIR \f[\rho \left (r \right ) = C^2 \cdot \left ( \frac{r}{C} - \log{\left(1 + \frac{r}{C}\right)} \right ) \quad \text{where} \quad C=1.3998\f]
  • DIST_WELSCH \f[\rho \left (r \right ) = \frac{C^2}{2} \cdot \left ( 1 - \exp{\left(-\left(\frac{r}{C}\right)^2\right)} \right ) \quad \text{where} \quad C=2.9846\f]
  • DIST_HUBER \f[\rho (r) = \fork{r^2/2}{if (r < C)}{C \cdot (r-C/2)}{otherwise} \quad \text{where} \quad C=1.345\f] The algorithm is based on the M-estimator ( http://en.wikipedia.org/wiki/M-estimator ) technique that iteratively fits the line using the weighted least-squares algorithm. After each iteration the weights \f$w_i\f$ are adjusted to be inversely proportional to \f$\rho(r_i)\f$ . (like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and (x0, y0) is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line and (x0, y0, z0) is a point on the line. is chosen.

Python prototype (for reference):

fitLine(points, distType, param, reps, aeps[, line]) -> line
Link to this function

fitLine(points, distType, param, reps, aeps, opts)

View Source
Positional Arguments
  • points: UMat.
  • distType: int.
  • param: double.
  • reps: double.
  • aeps: double.
Keyword Arguments
  • line: UMat.

Fits a line to a 2D or 3D point set. The function fitLine fits a line to a 2D or 3D point set by minimizing \f$\sum_i \rho(r_i)\f$ where \f$r_i\f$ is a distance between the \f$i^{th}\f$ point, the line and \f$\rho(r)\f$ is a distance function, one of the following:

  • DIST_L2 \f[\rho (r) = r^2/2 \quad \text{(the simplest and the fastest least-squares method)}\f]
  • DIST_L1 \f[\rho (r) = r\f]
  • DIST_L12 \f[\rho (r) = 2 \cdot ( \sqrt{1 + \frac{r^2}{2}} - 1)\f]
  • DIST_FAIR \f[\rho \left (r \right ) = C^2 \cdot \left ( \frac{r}{C} - \log{\left(1 + \frac{r}{C}\right)} \right ) \quad \text{where} \quad C=1.3998\f]
  • DIST_WELSCH \f[\rho \left (r \right ) = \frac{C^2}{2} \cdot \left ( 1 - \exp{\left(-\left(\frac{r}{C}\right)^2\right)} \right ) \quad \text{where} \quad C=2.9846\f]
  • DIST_HUBER \f[\rho (r) = \fork{r^2/2}{if (r < C)}{C \cdot (r-C/2)}{otherwise} \quad \text{where} \quad C=1.345\f] The algorithm is based on the M-estimator ( http://en.wikipedia.org/wiki/M-estimator ) technique that iteratively fits the line using the weighted least-squares algorithm. After each iteration the weights \f$w_i\f$ are adjusted to be inversely proportional to \f$\rho(r_i)\f$ . (like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and (x0, y0) is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line and (x0, y0, z0) is a point on the line. is chosen.

Python prototype (for reference):

fitLine(points, distType, param, reps, aeps[, line]) -> line
Positional Arguments
  • src: UMat.
  • flipCode: int.
Keyword Arguments
  • dst: UMat.

Flips a 2D array around vertical, horizontal, or both axes. The function cv::flip flips the array in one of three different ways (row and column indices are 0-based): \f[\texttt{dst} _{ij} = \left\{ \begin{array}{l l} \texttt{src} _{\texttt{src.rows}-i-1,j} & if\; \texttt{flipCode} = 0 \\ \texttt{src} _{i, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} > 0 \\ \texttt{src} _{ \texttt{src.rows} -i-1, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} < 0 \\ \end{array} \right.\f] The example scenarios of using the function are the following:

 Vertical flipping of the image (flipCode == 0) to switch between

top-left and bottom-left image origin. This is a typical operation in video processing on Microsoft Windows* OS.

 Horizontal flipping of the image with the subsequent horizontal

shift and absolute difference calculation to check for a vertical-axis symmetry (flipCode > 0).

 Simultaneous horizontal and vertical flipping of the image with

the subsequent shift and absolute difference calculation to check for a central symmetry (flipCode \< 0).

 Reversing the order of point arrays (flipCode \> 0 or

flipCode == 0).

flipping around the x-axis and positive value (for example, 1) means
flipping around y-axis. Negative value (for example, -1) means flipping
around both axes.

@sa transpose , repeat , completeSymm

Python prototype (for reference):

flip(src, flipCode[, dst]) -> dst
Link to this function

flip(src, flipCode, opts)

View Source
Positional Arguments
  • src: UMat.
  • flipCode: int.
Keyword Arguments
  • dst: UMat.

Flips a 2D array around vertical, horizontal, or both axes. The function cv::flip flips the array in one of three different ways (row and column indices are 0-based): \f[\texttt{dst} _{ij} = \left\{ \begin{array}{l l} \texttt{src} _{\texttt{src.rows}-i-1,j} & if\; \texttt{flipCode} = 0 \\ \texttt{src} _{i, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} > 0 \\ \texttt{src} _{ \texttt{src.rows} -i-1, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} < 0 \\ \end{array} \right.\f] The example scenarios of using the function are the following:

 Vertical flipping of the image (flipCode == 0) to switch between

top-left and bottom-left image origin. This is a typical operation in video processing on Microsoft Windows* OS.

 Horizontal flipping of the image with the subsequent horizontal

shift and absolute difference calculation to check for a vertical-axis symmetry (flipCode > 0).

 Simultaneous horizontal and vertical flipping of the image with

the subsequent shift and absolute difference calculation to check for a central symmetry (flipCode \< 0).

 Reversing the order of point arrays (flipCode \> 0 or

flipCode == 0).

flipping around the x-axis and positive value (for example, 1) means
flipping around y-axis. Negative value (for example, -1) means flipping
around both axes.

@sa transpose , repeat , completeSymm

Python prototype (for reference):

flip(src, flipCode[, dst]) -> dst
Link to this function

floodFill(image, mask, seedPoint, newVal)

View Source
Positional Arguments
  • image: UMat.
  • mask: UMat.
  • seedPoint: Point.
  • newVal: Scalar.
Keyword Arguments
  • loDiff: Scalar.
  • upDiff: Scalar.
  • flags: int.

Fills a connected component with the given color. The function cv::floodFill fills a connected component starting from the seed point with the specified color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The pixel at \f$(x,y)\f$ is considered to belong to the repainted domain if:

  • in case of a grayscale image and floating range \f[\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} (x',y')+ \texttt{upDiff}\f]
  • in case of a grayscale image and fixed range \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}\f]
  • in case of a color image and floating range \f[\texttt{src} (x',y')_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} (x',y')_r+ \texttt{upDiff} _r,\f] \f[\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g\f] and \f[\texttt{src} (x',y')_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} (x',y')_b+ \texttt{upDiff} _b\f]
  • in case of a color image and fixed range \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,\f] \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g\f] and \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b\f] where \f$src(x',y')\f$ is the value of one of pixel neighbors that is already known to belong to the component. That is, to be added to the connected component, a color/brightness of the pixel should be close enough to:
  • Color/brightness of one of its neighbors that already belong to the connected component in case of a floating range.
  • Color/brightness of the seed point in case of a fixed range. Use these functions to either mark a connected component with the specified color in-place, or build a mask and then extract the contour, or copy the region to another image, and so on. function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See the details below. taller than image. If an empty Mat is passed it will be created automatically. Since this is both an input and output parameter, you must take responsibility of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example, an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the mask corresponding to filled pixels in the image are set to 1 or to the specified value in flags as described below. Additionally, the function fills the border of the mask with ones to simplify internal processing. It is therefore possible to use the same mask in multiple calls to the function to make sure the filled areas do not overlap. one of its neighbors belonging to the component, or a seed pixel being added to the component. one of its neighbors belonging to the component, or a seed pixel being added to the component. repainted domain. 4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner) will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill the mask (the default value is 1). For example, 4 | ( 255 \<\< 8 ) will consider 4 nearest neighbours and fill the mask with a value of 255. The following additional options occupy higher bits and therefore may be further combined with the connectivity and mask fill values using bit-wise or (|), see #FloodFillFlags. Note: Since the mask is larger than the filled image, a pixel \f$(x, y)\f$ in image corresponds to the pixel \f$(x+1, y+1)\f$ in the mask . @sa findContours

Python prototype (for reference):

floodFill(image, mask, seedPoint, newVal[, loDiff[, upDiff[, flags]]]) -> retval, image, mask, rect
Link to this function

floodFill(image, mask, seedPoint, newVal, opts)

View Source
Positional Arguments
  • image: UMat.
  • mask: UMat.
  • seedPoint: Point.
  • newVal: Scalar.
Keyword Arguments
  • loDiff: Scalar.
  • upDiff: Scalar.
  • flags: int.

Fills a connected component with the given color. The function cv::floodFill fills a connected component starting from the seed point with the specified color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The pixel at \f$(x,y)\f$ is considered to belong to the repainted domain if:

  • in case of a grayscale image and floating range \f[\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} (x',y')+ \texttt{upDiff}\f]
  • in case of a grayscale image and fixed range \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}\f]
  • in case of a color image and floating range \f[\texttt{src} (x',y')_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} (x',y')_r+ \texttt{upDiff} _r,\f] \f[\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g\f] and \f[\texttt{src} (x',y')_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} (x',y')_b+ \texttt{upDiff} _b\f]
  • in case of a color image and fixed range \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,\f] \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g\f] and \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b\f] where \f$src(x',y')\f$ is the value of one of pixel neighbors that is already known to belong to the component. That is, to be added to the connected component, a color/brightness of the pixel should be close enough to:
  • Color/brightness of one of its neighbors that already belong to the connected component in case of a floating range.
  • Color/brightness of the seed point in case of a fixed range. Use these functions to either mark a connected component with the specified color in-place, or build a mask and then extract the contour, or copy the region to another image, and so on. function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See the details below. taller than image. If an empty Mat is passed it will be created automatically. Since this is both an input and output parameter, you must take responsibility of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example, an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the mask corresponding to filled pixels in the image are set to 1 or to the specified value in flags as described below. Additionally, the function fills the border of the mask with ones to simplify internal processing. It is therefore possible to use the same mask in multiple calls to the function to make sure the filled areas do not overlap. one of its neighbors belonging to the component, or a seed pixel being added to the component. one of its neighbors belonging to the component, or a seed pixel being added to the component. repainted domain. 4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner) will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill the mask (the default value is 1). For example, 4 | ( 255 \<\< 8 ) will consider 4 nearest neighbours and fill the mask with a value of 255. The following additional options occupy higher bits and therefore may be further combined with the connectivity and mask fill values using bit-wise or (|), see #FloodFillFlags. Note: Since the mask is larger than the filled image, a pixel \f$(x, y)\f$ in image corresponds to the pixel \f$(x+1, y+1)\f$ in the mask . @sa findContours

Python prototype (for reference):

floodFill(image, mask, seedPoint, newVal[, loDiff[, upDiff[, flags]]]) -> retval, image, mask, rect
Link to this function

gaussianBlur(src, ksize, sigmaX)

View Source
Positional Arguments
  • src: UMat.
  • ksize: Size.
  • sigmaX: double.
Keyword Arguments
  • dst: UMat.
  • sigmaY: double.
  • borderType: int.

Blurs an image using a Gaussian filter. The function convolves the source image with the specified Gaussian kernel. In-place filtering is supported.

independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
positive and odd. Or, they can be zero's and then they are computed from sigma.
equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height,
respectively (see #getGaussianKernel for details); to fully control the result regardless of
possible future modifications of all this semantics, it is recommended to specify all of ksize,
sigmaX, and sigmaY.

@sa sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlur

Python prototype (for reference):

GaussianBlur(src, ksize, sigmaX[, dst[, sigmaY[, borderType]]]) -> dst
Link to this function

gaussianBlur(src, ksize, sigmaX, opts)

View Source
Positional Arguments
  • src: UMat.
  • ksize: Size.
  • sigmaX: double.
Keyword Arguments
  • dst: UMat.
  • sigmaY: double.
  • borderType: int.

Blurs an image using a Gaussian filter. The function convolves the source image with the specified Gaussian kernel. In-place filtering is supported.

independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
positive and odd. Or, they can be zero's and then they are computed from sigma.
equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height,
respectively (see #getGaussianKernel for details); to fully control the result regardless of
possible future modifications of all this semantics, it is recommended to specify all of ksize,
sigmaX, and sigmaY.

@sa sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlur

Python prototype (for reference):

GaussianBlur(src, ksize, sigmaX[, dst[, sigmaY[, borderType]]]) -> dst
Link to this function

gemm(src1, src2, alpha, src3, beta)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • alpha: double.
  • src3: UMat.
  • beta: double.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Performs generalized matrix multiplication. The function cv::gemm performs generalized matrix multiplication similar to the gemm functions in BLAS level 3. For example, gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T) corresponds to \f[\texttt{dst} = \texttt{alpha} \cdot \texttt{src1} ^T \cdot \texttt{src2} + \texttt{beta} \cdot \texttt{src3} ^T\f] In case of complex (two-channel) data, performed a complex matrix multiplication. The function can be replaced with a matrix expression. For example, the above call can be replaced with:

dst = alpha*src1.t()*src2 + beta*src3.t();
CV_64FC1) or complex(CV_32FC2, CV_64FC2).
should have the same type as src1 and src2.
input matrices.

@sa mulTransposed , transform

Python prototype (for reference):

gemm(src1, src2, alpha, src3, beta[, dst[, flags]]) -> dst
Link to this function

gemm(src1, src2, alpha, src3, beta, opts)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
  • alpha: double.
  • src3: UMat.
  • beta: double.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Performs generalized matrix multiplication. The function cv::gemm performs generalized matrix multiplication similar to the gemm functions in BLAS level 3. For example, gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T) corresponds to \f[\texttt{dst} = \texttt{alpha} \cdot \texttt{src1} ^T \cdot \texttt{src2} + \texttt{beta} \cdot \texttt{src3} ^T\f] In case of complex (two-channel) data, performed a complex matrix multiplication. The function can be replaced with a matrix expression. For example, the above call can be replaced with:

dst = alpha*src1.t()*src2 + beta*src3.t();
CV_64FC1) or complex(CV_32FC2, CV_64FC2).
should have the same type as src1 and src2.
input matrices.

@sa mulTransposed , transform

Python prototype (for reference):

gemm(src1, src2, alpha, src3, beta[, dst[, flags]]) -> dst
Link to this function

getAffineTransform(src, dst)

View Source

Has overloading in C++

Python prototype (for reference):

getAffineTransform(src, dst) -> retval

Returns full configuration time cmake output. Returned value is raw cmake output including version control system revision, compiler version, compiler flags, enabled modules and third party libraries, etc. Output format depends on target architecture.

Python prototype (for reference):

getBuildInformation() -> retval

Returns list of CPU features enabled during compilation. Returned value is a string containing space separated list of CPU features with following markers:

  • no markers - baseline features
  • prefix * - features enabled in dispatcher
  • suffix ? - features enabled but not available in HW Example: SSE SSE2 SSE3 *SSE4.1 *SSE4.2 *FP16 *AVX *AVX2 *AVX512-SKX?

Python prototype (for reference):

getCPUFeaturesLine() -> retval

Returns the number of CPU ticks. The function returns the current number of CPU ticks on some architectures (such as x86, x64, PowerPC). On other platforms the function is equivalent to getTickCount. It can also be used for very accurate time measurements, as well as for RNG initialization. Note that in case of multi-CPU systems a thread, from which getCPUTickCount is called, can be suspended and resumed at another CPU with its own counter. So, theoretically (and practically) the subsequent calls to the function do not necessary return the monotonously increasing values. Also, since a modern CPU varies the CPU frequency depending on the load, the number of CPU clocks spent in some code cannot be directly converted to time units. Therefore, getTickCount is generally a preferable solution for measuring execution time.

Python prototype (for reference):

getCPUTickCount() -> retval
Link to this function

getDefaultNewCameraMatrix(cameraMatrix)

View Source
Positional Arguments
  • cameraMatrix: UMat.
Keyword Arguments
  • imgsize: Size.
  • centerPrincipalPoint: bool.

Returns the default new camera matrix. The function returns the camera matrix that is either an exact copy of the input cameraMatrix (when centerPrinicipalPoint=false ), or the modified one (when centerPrincipalPoint=true). In the latter case, the new camera matrix will be: \f[\begin{bmatrix} f_x && 0 && ( \texttt{imgSize.width} -1)*0.5 \\ 0 && f_y && ( \texttt{imgSize.height} -1)*0.5 \\ 0 && 0 && 1 \end{bmatrix} ,\f] where \f$f_x\f$ and \f$f_y\f$ are \f$(0,0)\f$ and \f$(1,1)\f$ elements of cameraMatrix, respectively. By default, the undistortion functions in OpenCV (see #initUndistortRectifyMap, #undistort) do not move the principal point. However, when you work with stereo, it is important to move the principal points in both views to the same y-coordinate (which is required by most of stereo correspondence algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for each view where the principal points are located at the center.

parameter indicates whether this location should be at the image center or not.

Python prototype (for reference):

getDefaultNewCameraMatrix(cameraMatrix[, imgsize[, centerPrincipalPoint]]) -> retval
Link to this function

getDefaultNewCameraMatrix(cameraMatrix, opts)

View Source
Positional Arguments
  • cameraMatrix: UMat.
Keyword Arguments
  • imgsize: Size.
  • centerPrincipalPoint: bool.

Returns the default new camera matrix. The function returns the camera matrix that is either an exact copy of the input cameraMatrix (when centerPrinicipalPoint=false ), or the modified one (when centerPrincipalPoint=true). In the latter case, the new camera matrix will be: \f[\begin{bmatrix} f_x && 0 && ( \texttt{imgSize.width} -1)*0.5 \\ 0 && f_y && ( \texttt{imgSize.height} -1)*0.5 \\ 0 && 0 && 1 \end{bmatrix} ,\f] where \f$f_x\f$ and \f$f_y\f$ are \f$(0,0)\f$ and \f$(1,1)\f$ elements of cameraMatrix, respectively. By default, the undistortion functions in OpenCV (see #initUndistortRectifyMap, #undistort) do not move the principal point. However, when you work with stereo, it is important to move the principal points in both views to the same y-coordinate (which is required by most of stereo correspondence algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for each view where the principal points are located at the center.

parameter indicates whether this location should be at the image center or not.

Python prototype (for reference):

getDefaultNewCameraMatrix(cameraMatrix[, imgsize[, centerPrincipalPoint]]) -> retval
Link to this function

getDerivKernels(dx, dy, ksize)

View Source
Positional Arguments
  • dx: int.
  • dy: int.
  • ksize: int.
Keyword Arguments
  • kx: UMat.
  • ky: UMat.
  • normalize: bool.
  • ktype: int.

Returns filter coefficients for computing spatial image derivatives. The function computes and returns the filter coefficients for spatial image derivatives. When ksize=FILTER_SCHARR, the Scharr \f$3 \times 3\f$ kernels are generated (see #Scharr). Otherwise, Sobel kernels are generated (see #Sobel). The filters are normally passed to #sepFilter2D or to

Theoretically, the coefficients should have the denominator \f$=2^{ksize\*2-dx-dy-2}\f$. If you are
going to filter floating-point images, you are likely to use the normalized kernels. But if you
compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve
all the fractional bits, you may want to set normalize=false .

Python prototype (for reference):

getDerivKernels(dx, dy, ksize[, kx[, ky[, normalize[, ktype]]]]) -> kx, ky
Link to this function

getDerivKernels(dx, dy, ksize, opts)

View Source
Positional Arguments
  • dx: int.
  • dy: int.
  • ksize: int.
Keyword Arguments
  • kx: UMat.
  • ky: UMat.
  • normalize: bool.
  • ktype: int.

Returns filter coefficients for computing spatial image derivatives. The function computes and returns the filter coefficients for spatial image derivatives. When ksize=FILTER_SCHARR, the Scharr \f$3 \times 3\f$ kernels are generated (see #Scharr). Otherwise, Sobel kernels are generated (see #Sobel). The filters are normally passed to #sepFilter2D or to

Theoretically, the coefficients should have the denominator \f$=2^{ksize\*2-dx-dy-2}\f$. If you are
going to filter floating-point images, you are likely to use the normalized kernels. But if you
compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve
all the fractional bits, you may want to set normalize=false .

Python prototype (for reference):

getDerivKernels(dx, dy, ksize[, kx[, ky[, normalize[, ktype]]]]) -> kx, ky
Link to this function

getFontScaleFromHeight(fontFace, pixelHeight)

View Source
Positional Arguments
  • fontFace: int.
  • pixelHeight: int.
Keyword Arguments
  • thickness: int.

Calculates the font-specific size to use to achieve a given height in pixels. @return The fontSize to use for cv::putText @see cv::putText

Python prototype (for reference):

getFontScaleFromHeight(fontFace, pixelHeight[, thickness]) -> retval
Link to this function

getFontScaleFromHeight(fontFace, pixelHeight, opts)

View Source
Positional Arguments
  • fontFace: int.
  • pixelHeight: int.
Keyword Arguments
  • thickness: int.

Calculates the font-specific size to use to achieve a given height in pixels. @return The fontSize to use for cv::putText @see cv::putText

Python prototype (for reference):

getFontScaleFromHeight(fontFace, pixelHeight[, thickness]) -> retval
Link to this function

getGaborKernel(ksize, sigma, theta, lambd, gamma)

View Source
Positional Arguments
  • ksize: Size.
  • sigma: double.
  • theta: double.
  • lambd: double.
  • gamma: double.
Keyword Arguments
  • psi: double.
  • ktype: int.

Returns Gabor filter coefficients. For more details about gabor filter equations and parameters, see: Gabor Filter.

Python prototype (for reference):

getGaborKernel(ksize, sigma, theta, lambd, gamma[, psi[, ktype]]) -> retval
Link to this function

getGaborKernel(ksize, sigma, theta, lambd, gamma, opts)

View Source
Positional Arguments
  • ksize: Size.
  • sigma: double.
  • theta: double.
  • lambd: double.
  • gamma: double.
Keyword Arguments
  • psi: double.
  • ktype: int.

Returns Gabor filter coefficients. For more details about gabor filter equations and parameters, see: Gabor Filter.

Python prototype (for reference):

getGaborKernel(ksize, sigma, theta, lambd, gamma[, psi[, ktype]]) -> retval
Link to this function

getGaussianKernel(ksize, sigma)

View Source
Positional Arguments
  • ksize: int.
  • sigma: double.
Keyword Arguments
  • ktype: int.

Returns Gaussian filter coefficients. The function computes and returns the \f$\texttt{ksize} \times 1\f$ matrix of Gaussian filter coefficients: \f[G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},\f] where \f$i=0..\texttt{ksize}-1\f$ and \f$\alpha\f$ is the scale factor chosen so that \f$\sum_i G_i=1\f$. Two of such generated kernels can be passed to sepFilter2D. Those functions automatically recognize smoothing kernels (a symmetrical kernel with sum of weights equal to 1) and handle them accordingly. You may also use the higher-level GaussianBlur.

`sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8`.

@sa sepFilter2D, getDerivKernels, getStructuringElement, GaussianBlur

Python prototype (for reference):

getGaussianKernel(ksize, sigma[, ktype]) -> retval
Link to this function

getGaussianKernel(ksize, sigma, opts)

View Source
Positional Arguments
  • ksize: int.
  • sigma: double.
Keyword Arguments
  • ktype: int.

Returns Gaussian filter coefficients. The function computes and returns the \f$\texttt{ksize} \times 1\f$ matrix of Gaussian filter coefficients: \f[G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},\f] where \f$i=0..\texttt{ksize}-1\f$ and \f$\alpha\f$ is the scale factor chosen so that \f$\sum_i G_i=1\f$. Two of such generated kernels can be passed to sepFilter2D. Those functions automatically recognize smoothing kernels (a symmetrical kernel with sum of weights equal to 1) and handle them accordingly. You may also use the higher-level GaussianBlur.

`sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8`.

@sa sepFilter2D, getDerivKernels, getStructuringElement, GaussianBlur

Python prototype (for reference):

getGaussianKernel(ksize, sigma[, ktype]) -> retval
Link to this function

getHardwareFeatureName(feature)

View Source

Returns feature name by ID Returns empty string if feature is not defined

Python prototype (for reference):

getHardwareFeatureName(feature) -> retval

Python prototype (for reference):

getLogLevel() -> retval

Returns the number of logical CPUs available for the process.

Python prototype (for reference):

getNumberOfCPUs() -> retval

Returns the number of threads used by OpenCV for parallel regions. Always returns 1 if OpenCV is built without threading support. The exact meaning of return value depends on the threading framework used by OpenCV library:

  • TBB - The number of threads, that OpenCV will try to use for parallel regions. If there is any tbb::thread_scheduler_init in user code conflicting with OpenCV, then function returns default number of threads used by TBB library.
  • OpenMP - An upper bound on the number of threads that could be used to form a new team.
  • Concurrency - The number of threads, that OpenCV will try to use for parallel regions.
  • GCD - Unsupported; returns the GCD thread pool limit (512) for compatibility.
  • C= - The number of threads, that OpenCV will try to use for parallel regions, if before called setNumThreads with threads > 0, otherwise returns the number of logical CPUs, available for the process. @sa setNumThreads, getThreadNum

Python prototype (for reference):

getNumThreads() -> retval
Link to this function

getOptimalDFTSize(vecsize)

View Source

Returns the optimal DFT size for a given vector size. DFT performance is not a monotonic function of a vector size. Therefore, when you calculate convolution of two arrays or perform the spectral analysis of an array, it usually makes sense to pad the input data with zeros to get a bit larger array that can be transformed much faster than the original one. Arrays whose size is a power-of-two (2, 4, 8, 16, 32, ...) are the fastest to process. Though, the arrays whose size is a product of 2's, 3's, and 5's (for example, 300 = 5*5*3*2*2) are also processed quite efficiently. The function cv::getOptimalDFTSize returns the minimum number N that is greater than or equal to vecsize so that the DFT of a vector of size N can be processed efficiently. In the current implementation N = 2 ^p^ * 3 ^q^ * 5 ^r^ for some integer p, q, r. The function returns a negative number if vecsize is too large (very close to INT_MAX ). While the function cannot be used directly to estimate the optimal vector size for DCT transform (since the current DCT implementation supports only even-size vectors), it can be easily processed as getOptimalDFTSize((vecsize+1)/2)*2. @sa dft , dct , idft , idct , mulSpectrums

Python prototype (for reference):

getOptimalDFTSize(vecsize) -> retval
Link to this function

getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha)

View Source
Positional Arguments
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • imageSize: Size.
  • alpha: double.
Keyword Arguments
  • newImgSize: Size.
  • centerPrincipalPoint: bool.

Returns the new camera intrinsic matrix based on the free scaling parameter.

\f$\distcoeffs\f$. If the vector is NULL/empty, the zero distortion coefficients are
assumed.
valid) and 1 (when all the source image pixels are retained in the undistorted image). See
#stereoRectify for details.
undistorted image. See roi1, roi2 description in #stereoRectify .
principal point should be at the image center or not. By default, the principal point is chosen to
best fit a subset of the source image (determined by alpha) to the corrected image.

@return new_camera_matrix Output new camera intrinsic matrix. The function computes and returns the optimal new camera intrinsic matrix based on the free scaling parameter. By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original image pixels if there is valuable information in the corners alpha=1 , or get something in between. When alpha>0 , the undistorted result is likely to have some black pixels corresponding to "virtual" pixels outside of the captured distorted image. The original camera intrinsic matrix, distortion coefficients, the computed new camera intrinsic matrix, and newImageSize should be passed to #initUndistortRectifyMap to produce the maps for #remap .

Python prototype (for reference):

getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha[, newImgSize[, centerPrincipalPoint]]) -> retval, validPixROI
Link to this function

getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha, opts)

View Source
Positional Arguments
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • imageSize: Size.
  • alpha: double.
Keyword Arguments
  • newImgSize: Size.
  • centerPrincipalPoint: bool.

Returns the new camera intrinsic matrix based on the free scaling parameter.

\f$\distcoeffs\f$. If the vector is NULL/empty, the zero distortion coefficients are
assumed.
valid) and 1 (when all the source image pixels are retained in the undistorted image). See
#stereoRectify for details.
undistorted image. See roi1, roi2 description in #stereoRectify .
principal point should be at the image center or not. By default, the principal point is chosen to
best fit a subset of the source image (determined by alpha) to the corrected image.

@return new_camera_matrix Output new camera intrinsic matrix. The function computes and returns the optimal new camera intrinsic matrix based on the free scaling parameter. By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original image pixels if there is valuable information in the corners alpha=1 , or get something in between. When alpha>0 , the undistorted result is likely to have some black pixels corresponding to "virtual" pixels outside of the captured distorted image. The original camera intrinsic matrix, distortion coefficients, the computed new camera intrinsic matrix, and newImageSize should be passed to #initUndistortRectifyMap to produce the maps for #remap .

Python prototype (for reference):

getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha[, newImgSize[, centerPrincipalPoint]]) -> retval, validPixROI
Link to this function

getPerspectiveTransform(src, dst)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • solveMethod: int.

Calculates a perspective transform from four pairs of the corresponding points. The function calculates the \f$3 \times 3\f$ matrix of a perspective transform so that: \f[\begin{bmatrix} t_i x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f] where \f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\f] @sa findHomography, warpPerspective, perspectiveTransform

Python prototype (for reference):

getPerspectiveTransform(src, dst[, solveMethod]) -> retval
Link to this function

getPerspectiveTransform(src, dst, opts)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • solveMethod: int.

Calculates a perspective transform from four pairs of the corresponding points. The function calculates the \f$3 \times 3\f$ matrix of a perspective transform so that: \f[\begin{bmatrix} t_i x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f] where \f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\f] @sa findHomography, warpPerspective, perspectiveTransform

Python prototype (for reference):

getPerspectiveTransform(src, dst[, solveMethod]) -> retval
Link to this function

getRectSubPix(image, patchSize, center)

View Source
Positional Arguments
  • image: UMat.
  • patchSize: Size.
  • center: Point2f.
Keyword Arguments
  • patch: UMat.
  • patchType: int.

Retrieves a pixel rectangle from an image with sub-pixel accuracy. The function getRectSubPix extracts pixels from src: \f[patch(x, y) = src(x + \texttt{center.x} - ( \texttt{dst.cols} -1)*0.5, y + \texttt{center.y} - ( \texttt{dst.rows} -1)*0.5)\f] where the values of the pixels at non-integer coordinates are retrieved using bilinear interpolation. Every channel of multi-channel images is processed independently. Also the image should be a single channel or three channel image. While the center of the rectangle must be inside the image, parts of the rectangle may be outside.

source image. The center must be inside the image.

@sa warpAffine, warpPerspective

Python prototype (for reference):

getRectSubPix(image, patchSize, center[, patch[, patchType]]) -> patch
Link to this function

getRectSubPix(image, patchSize, center, opts)

View Source
Positional Arguments
  • image: UMat.
  • patchSize: Size.
  • center: Point2f.
Keyword Arguments
  • patch: UMat.
  • patchType: int.

Retrieves a pixel rectangle from an image with sub-pixel accuracy. The function getRectSubPix extracts pixels from src: \f[patch(x, y) = src(x + \texttt{center.x} - ( \texttt{dst.cols} -1)*0.5, y + \texttt{center.y} - ( \texttt{dst.rows} -1)*0.5)\f] where the values of the pixels at non-integer coordinates are retrieved using bilinear interpolation. Every channel of multi-channel images is processed independently. Also the image should be a single channel or three channel image. While the center of the rectangle must be inside the image, parts of the rectangle may be outside.

source image. The center must be inside the image.

@sa warpAffine, warpPerspective

Python prototype (for reference):

getRectSubPix(image, patchSize, center[, patch[, patchType]]) -> patch
Link to this function

getRotationMatrix2D(center, angle, scale)

View Source

Calculates an affine matrix of 2D rotation. The function calculates the following matrix: \f[\begin{bmatrix} \alpha & \beta & (1- \alpha ) \cdot \texttt{center.x} - \beta \cdot \texttt{center.y} \\ - \beta & \alpha & \beta \cdot \texttt{center.x} + (1- \alpha ) \cdot \texttt{center.y} \end{bmatrix}\f] where \f[\begin{array}{l} \alpha = \texttt{scale} \cdot \cos \texttt{angle} , \\ \beta = \texttt{scale} \cdot \sin \texttt{angle} \end{array}\f] The transformation maps the rotation center to itself. If this is not the target, adjust the shift.

coordinate origin is assumed to be the top-left corner).

@sa getAffineTransform, warpAffine, transform

Python prototype (for reference):

getRotationMatrix2D(center, angle, scale) -> retval
Link to this function

getStructuringElement(shape, ksize)

View Source
Positional Arguments
  • shape: int.
  • ksize: Size.
Keyword Arguments
  • anchor: Point.

Returns a structuring element of the specified size and shape for morphological operations. The function constructs and returns the structuring element that can be further passed to #erode, #dilate or #morphologyEx. But you can also construct an arbitrary binary mask yourself and use it as the structuring element.

anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor
position. In other cases the anchor just regulates how much the result of the morphological
operation is shifted.

Python prototype (for reference):

getStructuringElement(shape, ksize[, anchor]) -> retval
Link to this function

getStructuringElement(shape, ksize, opts)

View Source
Positional Arguments
  • shape: int.
  • ksize: Size.
Keyword Arguments
  • anchor: Point.

Returns a structuring element of the specified size and shape for morphological operations. The function constructs and returns the structuring element that can be further passed to #erode, #dilate or #morphologyEx. But you can also construct an arbitrary binary mask yourself and use it as the structuring element.

anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor
position. In other cases the anchor just regulates how much the result of the morphological
operation is shifted.

Python prototype (for reference):

getStructuringElement(shape, ksize[, anchor]) -> retval
Link to this function

getTextSize(text, fontFace, fontScale, thickness)

View Source

Calculates the width and height of a text string. The function cv::getTextSize calculates and returns the size of a box that contains the specified text. That is, the following code renders some text, the tight box surrounding it, and the baseline: :

String text = "Funny text inside the box";
int fontFace = FONT_HERSHEY_SCRIPT_SIMPLEX;
double fontScale = 2;
int thickness = 3;
Mat img(600, 800, CV_8UC3, Scalar::all(0));
int baseline=0;
Size textSize = getTextSize(text, fontFace,
fontScale, thickness, &baseline);
baseline += thickness;
// center the text
Point textOrg((img.cols - textSize.width)/2,
(img.rows + textSize.height)/2);
// draw the box
rectangle(img, textOrg + Point(0, baseline),
textOrg + Point(textSize.width, -textSize.height),
Scalar(0,0,255));
// ... and the baseline first
line(img, textOrg + Point(0, thickness),
textOrg + Point(textSize.width, thickness),
Scalar(0, 0, 255));
// then put the text itself
putText(img, text, textOrg, fontFace, fontScale,
Scalar::all(255), thickness, 8);
point.

@return The size of a box that contains the specified text. @see putText

Python prototype (for reference):

getTextSize(text, fontFace, fontScale, thickness) -> retval, baseLine

Returns the index of the currently executed thread within the current parallel region. Always returns 0 if called outside of parallel region. @deprecated Current implementation doesn't corresponding to this documentation. The exact meaning of the return value depends on the threading framework used by OpenCV library:

  • TBB - Unsupported with current 4.1 TBB release. Maybe will be supported in future.
  • OpenMP - The thread number, within the current team, of the calling thread.
  • Concurrency - An ID for the virtual processor that the current context is executing on (0 for master thread and unique number for others, but not necessary 1,2,3,...).
  • GCD - System calling thread's ID. Never returns 0 inside parallel region.
  • C= - The index of the current parallel task. @sa setNumThreads, getNumThreads

Python prototype (for reference):

getThreadNum() -> retval

Returns the number of ticks. The function returns the number of ticks after the certain event (for example, when the machine was turned on). It can be used to initialize RNG or to measure a function execution time by reading the tick count before and after the function call. @sa getTickFrequency, TickMeter

Python prototype (for reference):

getTickCount() -> retval

Returns the number of ticks per second. The function returns the number of ticks per second. That is, the following code computes the execution time in seconds:

double t = (double)getTickCount();
// do something ...
t = ((double)getTickCount() - t)/getTickFrequency();

@sa getTickCount, TickMeter

Python prototype (for reference):

getTickFrequency() -> retval
Link to this function

getTrackbarPos(trackbarname, winname)

View Source

Returns the trackbar position. The function returns the current position of the specified trackbar. Note: [Qt Backend Only] winname can be empty if the trackbar is attached to the control panel.

Python prototype (for reference):

getTrackbarPos(trackbarname, winname) -> retval
Link to this function

getValidDisparityROI(roi1, roi2, minDisparity, numberOfDisparities, blockSize)

View Source

Python prototype (for reference):

getValidDisparityROI(roi1, roi2, minDisparity, numberOfDisparities, blockSize) -> retval

Returns major library version

Python prototype (for reference):

getVersionMajor() -> retval

Returns minor library version

Python prototype (for reference):

getVersionMinor() -> retval

Returns revision field of the library version

Python prototype (for reference):

getVersionRevision() -> retval

Returns library version string For example "3.4.1-dev". @sa getMajorVersion, getMinorVersion, getRevisionVersion

Python prototype (for reference):

getVersionString() -> retval
Link to this function

getWindowImageRect(winname)

View Source

Provides rectangle of image in the window. The function getWindowImageRect returns the client screen coordinates, width and height of the image rendering area. @sa resizeWindow moveWindow

Python prototype (for reference):

getWindowImageRect(winname) -> retval
Link to this function

getWindowProperty(winname, prop_id)

View Source

Provides parameters of a window. The function getWindowProperty returns properties of a window. @sa setWindowProperty

Python prototype (for reference):

getWindowProperty(winname, prop_id) -> retval
Link to this function

goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance)

View Source
Positional Arguments
  • image: UMat.
  • maxCorners: int.
  • qualityLevel: double.
  • minDistance: double.
Keyword Arguments
  • corners: UMat.
  • mask: UMat.
  • blockSize: int.
  • useHarrisDetector: bool.
  • k: double.

Determines strong corners on an image. The function finds the most prominent corners in the image or in the specified image region, as described in @cite Shi94

  • Function calculates the corner quality measure at every source image pixel using the #cornerMinEigenVal or #cornerHarris .
  • Function performs a non-maximum suppression (the local maximums in 3 x 3 neighborhood are retained).
  • The corners with the minimal eigenvalue less than \f$\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\f$ are rejected.
  • The remaining corners are sorted by the quality measure in the descending order.
  • Function throws away each corner for which there is a stronger corner at a distance less than maxDistance. The function can be used to initialize a point-based tracker of an object. Note: If the function is called with different values A and B of the parameter qualityLevel , and A > B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector with qualityLevel=B . the strongest of them is returned. maxCorners <= 0 implies that no limit on the maximum is set and all detected corners are returned. parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure less than 15 are rejected. CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected. pixel neighborhood. See cornerEigenValsAndVecs . or #cornerMinEigenVal. @sa cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,

Python prototype (for reference):

goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance[, corners[, mask[, blockSize[, useHarrisDetector[, k]]]]]) -> corners
Link to this function

goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance, opts)

View Source
Positional Arguments
  • image: UMat.
  • maxCorners: int.
  • qualityLevel: double.
  • minDistance: double.
Keyword Arguments
  • corners: UMat.
  • mask: UMat.
  • blockSize: int.
  • useHarrisDetector: bool.
  • k: double.

Determines strong corners on an image. The function finds the most prominent corners in the image or in the specified image region, as described in @cite Shi94

  • Function calculates the corner quality measure at every source image pixel using the #cornerMinEigenVal or #cornerHarris .
  • Function performs a non-maximum suppression (the local maximums in 3 x 3 neighborhood are retained).
  • The corners with the minimal eigenvalue less than \f$\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\f$ are rejected.
  • The remaining corners are sorted by the quality measure in the descending order.
  • Function throws away each corner for which there is a stronger corner at a distance less than maxDistance. The function can be used to initialize a point-based tracker of an object. Note: If the function is called with different values A and B of the parameter qualityLevel , and A > B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector with qualityLevel=B . the strongest of them is returned. maxCorners <= 0 implies that no limit on the maximum is set and all detected corners are returned. parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure less than 15 are rejected. CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected. pixel neighborhood. See cornerEigenValsAndVecs . or #cornerMinEigenVal. @sa cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,

Python prototype (for reference):

goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance[, corners[, mask[, blockSize[, useHarrisDetector[, k]]]]]) -> corners
Link to this function

goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance, mask, blockSize, gradientSize)

View Source
Positional Arguments
  • image: UMat
  • maxCorners: int
  • qualityLevel: double
  • minDistance: double
  • mask: UMat
  • blockSize: int
  • gradientSize: int
Keyword Arguments
  • corners: UMat.
  • useHarrisDetector: bool.
  • k: double.

Python prototype (for reference):

goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance, mask, blockSize, gradientSize[, corners[, useHarrisDetector[, k]]]) -> corners
Link to this function

goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance, mask, blockSize, gradientSize, opts)

View Source
Positional Arguments
  • image: UMat
  • maxCorners: int
  • qualityLevel: double
  • minDistance: double
  • mask: UMat
  • blockSize: int
  • gradientSize: int
Keyword Arguments
  • corners: UMat.
  • useHarrisDetector: bool.
  • k: double.

Python prototype (for reference):

goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance, mask, blockSize, gradientSize[, corners[, useHarrisDetector[, k]]]) -> corners
Link to this function

goodFeaturesToTrackWithQuality(image, maxCorners, qualityLevel, minDistance, mask)

View Source
Positional Arguments
  • image: UMat.
  • maxCorners: int.
  • qualityLevel: double.
  • minDistance: double.
  • mask: UMat.
Keyword Arguments
  • corners: UMat.
  • cornersQuality: UMat.
  • blockSize: int.
  • gradientSize: int.
  • useHarrisDetector: bool.
  • k: double.

Same as above, but returns also quality measure of the detected corners.

the strongest of them is returned. `maxCorners <= 0` implies that no limit on the maximum is set
and all detected corners are returned.
parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
(see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
quality measure less than the product are rejected. For example, if the best corner has the
quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
less than 15 are rejected.
CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
pixel neighborhood. See cornerEigenValsAndVecs .
See cornerEigenValsAndVecs .
or #cornerMinEigenVal.

Python prototype (for reference):

goodFeaturesToTrackWithQuality(image, maxCorners, qualityLevel, minDistance, mask[, corners[, cornersQuality[, blockSize[, gradientSize[, useHarrisDetector[, k]]]]]]) -> corners, cornersQuality
Link to this function

goodFeaturesToTrackWithQuality(image, maxCorners, qualityLevel, minDistance, mask, opts)

View Source
Positional Arguments
  • image: UMat.
  • maxCorners: int.
  • qualityLevel: double.
  • minDistance: double.
  • mask: UMat.
Keyword Arguments
  • corners: UMat.
  • cornersQuality: UMat.
  • blockSize: int.
  • gradientSize: int.
  • useHarrisDetector: bool.
  • k: double.

Same as above, but returns also quality measure of the detected corners.

the strongest of them is returned. `maxCorners <= 0` implies that no limit on the maximum is set
and all detected corners are returned.
parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
(see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
quality measure less than the product are rejected. For example, if the best corner has the
quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
less than 15 are rejected.
CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
pixel neighborhood. See cornerEigenValsAndVecs .
See cornerEigenValsAndVecs .
or #cornerMinEigenVal.

Python prototype (for reference):

goodFeaturesToTrackWithQuality(image, maxCorners, qualityLevel, minDistance, mask[, corners[, cornersQuality[, blockSize[, gradientSize[, useHarrisDetector[, k]]]]]]) -> corners, cornersQuality
Link to this function

grabCut(img, mask, rect, bgdModel, fgdModel, iterCount)

View Source
Positional Arguments
  • img: UMat.
  • mask: UMat.
  • rect: Rect.
  • bgdModel: UMat.
  • fgdModel: UMat.
  • iterCount: int.
Keyword Arguments
  • mode: int.

Runs the GrabCut algorithm. The function implements the GrabCut image segmentation algorithm.

mode is set to #GC_INIT_WITH_RECT. Its elements may have one of the #GrabCutClasses.
"obvious background". The parameter is only used when mode==#GC_INIT_WITH_RECT .
processing the same image.
processing the same image.
that the result can be refined with further calls with mode==#GC_INIT_WITH_MASK or
mode==GC_EVAL .

Python prototype (for reference):

grabCut(img, mask, rect, bgdModel, fgdModel, iterCount[, mode]) -> mask, bgdModel, fgdModel
Link to this function

grabCut(img, mask, rect, bgdModel, fgdModel, iterCount, opts)

View Source
Positional Arguments
  • img: UMat.
  • mask: UMat.
  • rect: Rect.
  • bgdModel: UMat.
  • fgdModel: UMat.
  • iterCount: int.
Keyword Arguments
  • mode: int.

Runs the GrabCut algorithm. The function implements the GrabCut image segmentation algorithm.

mode is set to #GC_INIT_WITH_RECT. Its elements may have one of the #GrabCutClasses.
"obvious background". The parameter is only used when mode==#GC_INIT_WITH_RECT .
processing the same image.
processing the same image.
that the result can be refined with further calls with mode==#GC_INIT_WITH_MASK or
mode==GC_EVAL .

Python prototype (for reference):

grabCut(img, mask, rect, bgdModel, fgdModel, iterCount[, mode]) -> mask, bgdModel, fgdModel
Link to this function

groupRectangles(rectList, groupThreshold)

View Source
Positional Arguments
  • rectList: vector_Rect
  • groupThreshold: int
Keyword Arguments
  • eps: double.

Has overloading in C++

Python prototype (for reference):

groupRectangles(rectList, groupThreshold[, eps]) -> rectList, weights
Link to this function

groupRectangles(rectList, groupThreshold, opts)

View Source
Positional Arguments
  • rectList: vector_Rect
  • groupThreshold: int
Keyword Arguments
  • eps: double.

Has overloading in C++

Python prototype (for reference):

groupRectangles(rectList, groupThreshold[, eps]) -> rectList, weights
Link to this function

haveImageReader(filename)

View Source

Returns true if the specified image can be decoded by OpenCV

Python prototype (for reference):

haveImageReader(filename) -> retval
Link to this function

haveImageWriter(filename)

View Source

Returns true if an image with the specified filename can be encoded by OpenCV

Python prototype (for reference):

haveImageWriter(filename) -> retval

Python prototype (for reference):

haveOpenVX() -> retval
Positional Arguments
  • src: vector_UMat.
Keyword Arguments
  • dst: UMat.

Has overloading in C++

std::vector<cv::Mat> matrices = { cv::Mat(4, 1, CV_8UC1, cv::Scalar(1)),
cv::Mat(4, 1, CV_8UC1, cv::Scalar(2)),
cv::Mat(4, 1, CV_8UC1, cv::Scalar(3)),};
cv::Mat out;
cv::hconcat( matrices, out );
//out:
//[1, 2, 3;
// 1, 2, 3;
// 1, 2, 3;
// 1, 2, 3]
same depth.

Python prototype (for reference):

hconcat(src[, dst]) -> dst
Positional Arguments
  • src: vector_UMat.
Keyword Arguments
  • dst: UMat.

Has overloading in C++

std::vector<cv::Mat> matrices = { cv::Mat(4, 1, CV_8UC1, cv::Scalar(1)),
cv::Mat(4, 1, CV_8UC1, cv::Scalar(2)),
cv::Mat(4, 1, CV_8UC1, cv::Scalar(3)),};
cv::Mat out;
cv::hconcat( matrices, out );
//out:
//[1, 2, 3;
// 1, 2, 3;
// 1, 2, 3;
// 1, 2, 3]
same depth.

Python prototype (for reference):

hconcat(src[, dst]) -> dst
Link to this function

houghCircles(image, method, dp, minDist)

View Source
Positional Arguments
  • image: UMat.
  • method: int.
  • dp: double.
  • minDist: double.
Keyword Arguments
  • circles: UMat.
  • param1: double.
  • param2: double.
  • minRadius: int.
  • maxRadius: int.

Finds circles in a grayscale image using the Hough transform. The function finds circles in a grayscale image using a modification of the Hough transform. Example: : @include snippets/imgproc_HoughLinesCircles.cpp Note: Usually the function detects the centers of circles well. However, it may fail to find correct radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if you know it. Or, in the case of #HOUGH_GRADIENT method you may set maxRadius to a negative number to return centers only without radius search, and find the correct radius using an additional procedure. It also helps to smooth image a bit unless it's already soft. For example, GaussianBlur() with 7x7 kernel and 1.5x1.5 sigma or similar blurring may help.

floating-point vector \f$(x, y, radius)\f$ or \f$(x, y, radius, votes)\f$ .
dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5,
unless some small very circles need to be detected.
too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
too large, some circles may be missed.
it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value
shough normally be higher, such as 300 or normally exposed and contrasty images.
accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
false circles may be detected. Circles, corresponding to the larger accumulator values, will be
returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure.
The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine.
If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less.
But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.
centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.

@sa fitEllipse, minEnclosingCircle

Python prototype (for reference):

HoughCircles(image, method, dp, minDist[, circles[, param1[, param2[, minRadius[, maxRadius]]]]]) -> circles
Link to this function

houghCircles(image, method, dp, minDist, opts)

View Source
Positional Arguments
  • image: UMat.
  • method: int.
  • dp: double.
  • minDist: double.
Keyword Arguments
  • circles: UMat.
  • param1: double.
  • param2: double.
  • minRadius: int.
  • maxRadius: int.

Finds circles in a grayscale image using the Hough transform. The function finds circles in a grayscale image using a modification of the Hough transform. Example: : @include snippets/imgproc_HoughLinesCircles.cpp Note: Usually the function detects the centers of circles well. However, it may fail to find correct radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if you know it. Or, in the case of #HOUGH_GRADIENT method you may set maxRadius to a negative number to return centers only without radius search, and find the correct radius using an additional procedure. It also helps to smooth image a bit unless it's already soft. For example, GaussianBlur() with 7x7 kernel and 1.5x1.5 sigma or similar blurring may help.

floating-point vector \f$(x, y, radius)\f$ or \f$(x, y, radius, votes)\f$ .
dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5,
unless some small very circles need to be detected.
too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
too large, some circles may be missed.
it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value
shough normally be higher, such as 300 or normally exposed and contrasty images.
accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
false circles may be detected. Circles, corresponding to the larger accumulator values, will be
returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure.
The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine.
If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less.
But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.
centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.

@sa fitEllipse, minEnclosingCircle

Python prototype (for reference):

HoughCircles(image, method, dp, minDist[, circles[, param1[, param2[, minRadius[, maxRadius]]]]]) -> circles
Link to this function

houghLines(image, rho, theta, threshold)

View Source
Positional Arguments
  • image: UMat.
  • rho: double.
  • theta: double.
  • threshold: int.
Keyword Arguments
  • lines: UMat.
  • srn: double.
  • stn: double.
  • min_theta: double.
  • max_theta: double.

Finds lines in a binary image using the standard Hough transform. The function implements the standard or standard multi-scale Hough transform algorithm for line detection. See http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for a good explanation of Hough transform.

\f$(\rho, \theta)\f$ or \f$(\rho, \theta, \textrm{votes})\f$ . \f$\rho\f$ is the distance from the coordinate origin \f$(0,0)\f$ (top-left corner of
the image). \f$\theta\f$ is the line rotation angle in radians (
\f$0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\f$ ).
\f$\textrm{votes}\f$ is the value of accumulator.
votes ( \f$>\texttt{threshold}\f$ ).
The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these
parameters should be positive.
Must fall between 0 and max_theta.
Must fall between min_theta and CV_PI.

Python prototype (for reference):

HoughLines(image, rho, theta, threshold[, lines[, srn[, stn[, min_theta[, max_theta]]]]]) -> lines
Link to this function

houghLines(image, rho, theta, threshold, opts)

View Source
Positional Arguments
  • image: UMat.
  • rho: double.
  • theta: double.
  • threshold: int.
Keyword Arguments
  • lines: UMat.
  • srn: double.
  • stn: double.
  • min_theta: double.
  • max_theta: double.

Finds lines in a binary image using the standard Hough transform. The function implements the standard or standard multi-scale Hough transform algorithm for line detection. See http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for a good explanation of Hough transform.

\f$(\rho, \theta)\f$ or \f$(\rho, \theta, \textrm{votes})\f$ . \f$\rho\f$ is the distance from the coordinate origin \f$(0,0)\f$ (top-left corner of
the image). \f$\theta\f$ is the line rotation angle in radians (
\f$0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\f$ ).
\f$\textrm{votes}\f$ is the value of accumulator.
votes ( \f$>\texttt{threshold}\f$ ).
The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these
parameters should be positive.
Must fall between 0 and max_theta.
Must fall between min_theta and CV_PI.

Python prototype (for reference):

HoughLines(image, rho, theta, threshold[, lines[, srn[, stn[, min_theta[, max_theta]]]]]) -> lines
Link to this function

houghLinesP(image, rho, theta, threshold)

View Source
Positional Arguments
  • image: UMat.
  • rho: double.
  • theta: double.
  • threshold: int.
Keyword Arguments
  • lines: UMat.
  • minLineLength: double.
  • maxLineGap: double.

Finds line segments in a binary image using the probabilistic Hough transform. The function implements the probabilistic Hough transform algorithm for line detection, described in @cite Matas00 See the line detection example below: @include snippets/imgproc_HoughLinesP.cpp This is a sample picture the function parameters have been tuned for: image And this is the output of the above program in case of the probabilistic Hough transform: image

\f$(x\_1, y\_1, x\_2, y\_2)\f$ , where \f$(x\_1,y\_1)\f$ and \f$(x\_2, y\_2)\f$ are the ending points of each detected
line segment.
votes ( \f$>\texttt{threshold}\f$ ).

@sa LineSegmentDetector

Python prototype (for reference):

HoughLinesP(image, rho, theta, threshold[, lines[, minLineLength[, maxLineGap]]]) -> lines
Link to this function

houghLinesP(image, rho, theta, threshold, opts)

View Source
Positional Arguments
  • image: UMat.
  • rho: double.
  • theta: double.
  • threshold: int.
Keyword Arguments
  • lines: UMat.
  • minLineLength: double.
  • maxLineGap: double.

Finds line segments in a binary image using the probabilistic Hough transform. The function implements the probabilistic Hough transform algorithm for line detection, described in @cite Matas00 See the line detection example below: @include snippets/imgproc_HoughLinesP.cpp This is a sample picture the function parameters have been tuned for: image And this is the output of the above program in case of the probabilistic Hough transform: image

\f$(x\_1, y\_1, x\_2, y\_2)\f$ , where \f$(x\_1,y\_1)\f$ and \f$(x\_2, y\_2)\f$ are the ending points of each detected
line segment.
votes ( \f$>\texttt{threshold}\f$ ).

@sa LineSegmentDetector

Python prototype (for reference):

HoughLinesP(image, rho, theta, threshold[, lines[, minLineLength[, maxLineGap]]]) -> lines
Link to this function

houghLinesPointSet(point, lines_max, threshold, min_rho, max_rho, rho_step, min_theta, max_theta, theta_step)

View Source
Positional Arguments
  • point: UMat.
  • lines_max: int.
  • threshold: int.
  • min_rho: double.
  • max_rho: double.
  • rho_step: double.
  • min_theta: double.
  • max_theta: double.
  • theta_step: double.
Keyword Arguments
  • lines: UMat.

Finds lines in a set of points using the standard Hough transform. The function finds lines in a set of points using a modification of the Hough transform. @include snippets/imgproc_HoughLinesPointSet.cpp

The larger the value of 'votes', the higher the reliability of the Hough line.
votes ( \f$>\texttt{threshold}\f$ ).

Python prototype (for reference):

HoughLinesPointSet(point, lines_max, threshold, min_rho, max_rho, rho_step, min_theta, max_theta, theta_step[, lines]) -> lines
Link to this function

houghLinesPointSet(point, lines_max, threshold, min_rho, max_rho, rho_step, min_theta, max_theta, theta_step, opts)

View Source
Positional Arguments
  • point: UMat.
  • lines_max: int.
  • threshold: int.
  • min_rho: double.
  • max_rho: double.
  • rho_step: double.
  • min_theta: double.
  • max_theta: double.
  • theta_step: double.
Keyword Arguments
  • lines: UMat.

Finds lines in a set of points using the standard Hough transform. The function finds lines in a set of points using a modification of the Hough transform. @include snippets/imgproc_HoughLinesPointSet.cpp

The larger the value of 'votes', the higher the reliability of the Hough line.
votes ( \f$>\texttt{threshold}\f$ ).

Python prototype (for reference):

HoughLinesPointSet(point, lines_max, threshold, min_rho, max_rho, rho_step, min_theta, max_theta, theta_step[, lines]) -> lines
Link to this function

houghLinesWithAccumulator(image, rho, theta, threshold)

View Source
Positional Arguments
  • image: UMat
  • rho: double
  • theta: double
  • threshold: int
Keyword Arguments
  • lines: UMat.
  • srn: double.
  • stn: double.
  • min_theta: double.
  • max_theta: double.

Finds lines in a binary image using the standard Hough transform and get accumulator. Note: This function is for bindings use only. Use original function in C++ code @sa HoughLines

Python prototype (for reference):

HoughLinesWithAccumulator(image, rho, theta, threshold[, lines[, srn[, stn[, min_theta[, max_theta]]]]]) -> lines
Link to this function

houghLinesWithAccumulator(image, rho, theta, threshold, opts)

View Source
Positional Arguments
  • image: UMat
  • rho: double
  • theta: double
  • threshold: int
Keyword Arguments
  • lines: UMat.
  • srn: double.
  • stn: double.
  • min_theta: double.
  • max_theta: double.

Finds lines in a binary image using the standard Hough transform and get accumulator. Note: This function is for bindings use only. Use original function in C++ code @sa HoughLines

Python prototype (for reference):

HoughLinesWithAccumulator(image, rho, theta, threshold[, lines[, srn[, stn[, min_theta[, max_theta]]]]]) -> lines
Positional Arguments
  • m: Moments
Keyword Arguments
  • hu: UMat.

Has overloading in C++

Python prototype (for reference):

HuMoments(m[, hu]) -> hu
Positional Arguments
  • m: Moments
Keyword Arguments
  • hu: UMat.

Has overloading in C++

Python prototype (for reference):

HuMoments(m[, hu]) -> hu
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Calculates the inverse Discrete Cosine Transform of a 1D or 2D array. idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE). @sa dct, dft, idft, getOptimalDFTSize

Python prototype (for reference):

idct(src[, dst[, flags]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Calculates the inverse Discrete Cosine Transform of a 1D or 2D array. idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE). @sa dct, dft, idft, getOptimalDFTSize

Python prototype (for reference):

idct(src[, dst[, flags]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • nonzeroRows: int.

Calculates the inverse Discrete Fourier Transform of a 1D or 2D array. idft(src, dst, flags) is equivalent to dft(src, dst, flags | #DFT_INVERSE) . Note: None of dft and idft scales the result by default. So, you should pass #DFT_SCALE to one of dft or idft explicitly to make these transforms mutually inverse. @sa dft, dct, idct, mulSpectrums, getOptimalDFTSize

the convolution sample in dft description.

Python prototype (for reference):

idft(src[, dst[, flags[, nonzeroRows]]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • nonzeroRows: int.

Calculates the inverse Discrete Fourier Transform of a 1D or 2D array. idft(src, dst, flags) is equivalent to dft(src, dst, flags | #DFT_INVERSE) . Note: None of dft and idft scales the result by default. So, you should pass #DFT_SCALE to one of dft or idft explicitly to make these transforms mutually inverse. @sa dft, dct, idct, mulSpectrums, getOptimalDFTSize

the convolution sample in dft description.

Python prototype (for reference):

idft(src[, dst[, flags[, nonzeroRows]]]) -> dst
Link to this function

illuminationChange(src, mask)

View Source
Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.
  • alpha: float.
  • beta: float.

Applying an appropriate non-linear transformation to the gradient field inside the selection and then integrating back with a Poisson solver, modifies locally the apparent illumination of an image. This is useful to highlight under-exposed foreground objects or to reduce specular reflections.

Python prototype (for reference):

illuminationChange(src, mask[, dst[, alpha[, beta]]]) -> dst
Link to this function

illuminationChange(src, mask, opts)

View Source
Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.
  • alpha: float.
  • beta: float.

Applying an appropriate non-linear transformation to the gradient field inside the selection and then integrating back with a Poisson solver, modifies locally the apparent illumination of an image. This is useful to highlight under-exposed foreground objects or to reduce specular reflections.

Python prototype (for reference):

illuminationChange(src, mask[, dst[, alpha[, beta]]]) -> dst
Positional Arguments
  • filename: String.
Keyword Arguments
  • flags: int.

Returns the number of images inside the give file The function imcount will return the number of pages in a multi-page image, or 1 for single-page images

Python prototype (for reference):

imcount(filename[, flags]) -> retval
Positional Arguments
  • filename: String.
Keyword Arguments
  • flags: int.

Returns the number of images inside the give file The function imcount will return the number of pages in a multi-page image, or 1 for single-page images

Python prototype (for reference):

imcount(filename[, flags]) -> retval
Positional Arguments
  • ext: String.
  • img: UMat.
Keyword Arguments
  • params: vector_int.

Encodes an image into a memory buffer. The function imencode compresses the image and stores it in the memory buffer that is resized to fit the result. See cv::imwrite for the list of supported formats and flags description.

Python prototype (for reference):

imencode(ext, img[, params]) -> retval, buf
Link to this function

imencode(ext, img, opts)

View Source
Positional Arguments
  • ext: String.
  • img: UMat.
Keyword Arguments
  • params: vector_int.

Encodes an image into a memory buffer. The function imencode compresses the image and stores it in the memory buffer that is resized to fit the result. See cv::imwrite for the list of supported formats and flags description.

Python prototype (for reference):

imencode(ext, img[, params]) -> retval, buf
Positional Arguments
  • filename: String.
Keyword Arguments
  • flags: int.

Loads an image from a file. @anchor imread The function imread loads an image from the specified file and returns it. If the image cannot be read (because of missing file, improper permissions, unsupported or invalid format), the function returns an empty matrix ( Mat::data==NULL ). Currently, the following file formats are supported:

  • Windows bitmaps - *.bmp, *.dib (always supported)
  • JPEG files - *.jpeg, *.jpg, *.jpe (see the Note section)
  • JPEG 2000 files - *.jp2 (see the Note section)
  • Portable Network Graphics - *.png (see the Note section)
  • WebP - *.webp (see the Note section)
  • Portable image format - *.pbm, *.pgm, *.ppm *.pxm, *.pnm (always supported)
  • PFM files - *.pfm (see the Note section)
  • Sun rasters - *.sr, *.ras (always supported)
  • TIFF files - *.tiff, *.tif (see the Note section)
  • OpenEXR Image files - *.exr (see the Note section)
  • Radiance HDR - *.hdr, *.pic (always supported)
  • Raster and Vector geospatial data supported by GDAL (see the Note section) Note:
  • The function determines the type of an image by the content, not by the file extension.
  • In the case of color images, the decoded images will have the channels stored in B G R order.
  • When using IMREAD_GRAYSCALE, the codec's internal grayscale conversion will be used, if available. Results may differ to the output of cvtColor()
  • On Microsoft Windows* OS and MacOSX*, the codecs shipped with an OpenCV image (libjpeg, libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs, and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware that currently these native image loaders give images with different pixel values because of the color management embedded into MacOSX.
  • On Linux*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for codecs supplied with an OS image. Install the relevant packages (do not forget the development files, for example, "libjpeg-dev", in Debian* and Ubuntu*) to get the codec support or turn on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake.
  • In the case you set WITH_GDAL flag to true in CMake and @ref IMREAD_LOAD_GDAL to load the image, then the GDAL driver will be used in order to decode the image, supporting the following formats: Raster, Vector.
  • If EXIF information is embedded in the image file, the EXIF orientation will be taken into account and thus the image will be rotated accordingly except if the flags @ref IMREAD_IGNORE_ORIENTATION or @ref IMREAD_UNCHANGED are passed.
  • Use the IMREAD_UNCHANGED flag to keep the floating point values from PFM image.
  • By default number of pixels must be less than 2^30. Limit can be set using system variable OPENCV_IO_MAX_IMAGE_PIXELS

Python prototype (for reference):

imread(filename[, flags]) -> retval
Positional Arguments
  • filename: String.
Keyword Arguments
  • flags: int.

Loads an image from a file. @anchor imread The function imread loads an image from the specified file and returns it. If the image cannot be read (because of missing file, improper permissions, unsupported or invalid format), the function returns an empty matrix ( Mat::data==NULL ). Currently, the following file formats are supported:

  • Windows bitmaps - *.bmp, *.dib (always supported)
  • JPEG files - *.jpeg, *.jpg, *.jpe (see the Note section)
  • JPEG 2000 files - *.jp2 (see the Note section)
  • Portable Network Graphics - *.png (see the Note section)
  • WebP - *.webp (see the Note section)
  • Portable image format - *.pbm, *.pgm, *.ppm *.pxm, *.pnm (always supported)
  • PFM files - *.pfm (see the Note section)
  • Sun rasters - *.sr, *.ras (always supported)
  • TIFF files - *.tiff, *.tif (see the Note section)
  • OpenEXR Image files - *.exr (see the Note section)
  • Radiance HDR - *.hdr, *.pic (always supported)
  • Raster and Vector geospatial data supported by GDAL (see the Note section) Note:
  • The function determines the type of an image by the content, not by the file extension.
  • In the case of color images, the decoded images will have the channels stored in B G R order.
  • When using IMREAD_GRAYSCALE, the codec's internal grayscale conversion will be used, if available. Results may differ to the output of cvtColor()
  • On Microsoft Windows* OS and MacOSX*, the codecs shipped with an OpenCV image (libjpeg, libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs, and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware that currently these native image loaders give images with different pixel values because of the color management embedded into MacOSX.
  • On Linux*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for codecs supplied with an OS image. Install the relevant packages (do not forget the development files, for example, "libjpeg-dev", in Debian* and Ubuntu*) to get the codec support or turn on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake.
  • In the case you set WITH_GDAL flag to true in CMake and @ref IMREAD_LOAD_GDAL to load the image, then the GDAL driver will be used in order to decode the image, supporting the following formats: Raster, Vector.
  • If EXIF information is embedded in the image file, the EXIF orientation will be taken into account and thus the image will be rotated accordingly except if the flags @ref IMREAD_IGNORE_ORIENTATION or @ref IMREAD_UNCHANGED are passed.
  • Use the IMREAD_UNCHANGED flag to keep the floating point values from PFM image.
  • By default number of pixels must be less than 2^30. Limit can be set using system variable OPENCV_IO_MAX_IMAGE_PIXELS

Python prototype (for reference):

imread(filename[, flags]) -> retval
Positional Arguments
  • filename: String.
Keyword Arguments
  • mats: vector_Mat.
  • flags: int.

Loads a multi-page image from a file. The function imreadmulti loads a multi-page image from the specified file into a vector of Mat objects. @sa cv::imread

Python prototype (for reference):

imreadmulti(filename[, mats[, flags]]) -> retval, mats
Link to this function

imreadmulti(filename, opts)

View Source
Positional Arguments
  • filename: String.
Keyword Arguments
  • mats: vector_Mat.
  • flags: int.

Loads a multi-page image from a file. The function imreadmulti loads a multi-page image from the specified file into a vector of Mat objects. @sa cv::imread

Python prototype (for reference):

imreadmulti(filename[, mats[, flags]]) -> retval, mats
Link to this function

imreadmulti(filename, start, count)

View Source
Positional Arguments
  • filename: String.
  • start: int.
  • count: int.
Keyword Arguments
  • mats: vector_Mat.
  • flags: int.

Loads a of images of a multi-page image from a file. The function imreadmulti loads a specified range from a multi-page image from the specified file into a vector of Mat objects. @sa cv::imread

Python prototype (for reference):

imreadmulti(filename, start, count[, mats[, flags]]) -> retval, mats
Link to this function

imreadmulti(filename, start, count, opts)

View Source
Positional Arguments
  • filename: String.
  • start: int.
  • count: int.
Keyword Arguments
  • mats: vector_Mat.
  • flags: int.

Loads a of images of a multi-page image from a file. The function imreadmulti loads a specified range from a multi-page image from the specified file into a vector of Mat objects. @sa cv::imread

Python prototype (for reference):

imreadmulti(filename, start, count[, mats[, flags]]) -> retval, mats
Positional Arguments
  • filename: String.
  • img: UMat.
Keyword Arguments
  • params: vector_int.

Saves an image to a specified file. The function imwrite saves the image to the specified file. The image format is chosen based on the filename extension (see cv::imread for the list of extensions). In general, only 8-bit single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function, with these exceptions:

  • 16-bit unsigned (CV_16U) images can be saved in the case of PNG, JPEG 2000, and TIFF formats
  • 32-bit float (CV_32F) images can be saved in PFM, TIFF, OpenEXR, and Radiance HDR formats; 3-channel (CV_32FC3) TIFF images will be saved using the LogLuv high dynamic range encoding (4 bytes per pixel)
  • PNG images with an alpha channel can be saved using this function. To do this, create 8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535 (see the code sample below).
  • Multiple images (vector of Mat) can be saved in TIFF format (see the code sample below). If the image format is not supported, the image will be converted to 8-bit unsigned (CV_8U) and saved that way. If the format, depth or channel order is different, use Mat::convertTo and cv::cvtColor to convert it before saving. Or, use the universal FileStorage I/O functions to save the image to XML or YAML format. The sample below shows how to create a BGRA image, how to set custom compression parameters and save it to a PNG file. It also demonstrates how to save multiple images in a TIFF file: @include snippets/imgcodecs_imwrite.cpp

Python prototype (for reference):

imwrite(filename, img[, params]) -> retval
Link to this function

imwrite(filename, img, opts)

View Source
Positional Arguments
  • filename: String.
  • img: UMat.
Keyword Arguments
  • params: vector_int.

Saves an image to a specified file. The function imwrite saves the image to the specified file. The image format is chosen based on the filename extension (see cv::imread for the list of extensions). In general, only 8-bit single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function, with these exceptions:

  • 16-bit unsigned (CV_16U) images can be saved in the case of PNG, JPEG 2000, and TIFF formats
  • 32-bit float (CV_32F) images can be saved in PFM, TIFF, OpenEXR, and Radiance HDR formats; 3-channel (CV_32FC3) TIFF images will be saved using the LogLuv high dynamic range encoding (4 bytes per pixel)
  • PNG images with an alpha channel can be saved using this function. To do this, create 8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535 (see the code sample below).
  • Multiple images (vector of Mat) can be saved in TIFF format (see the code sample below). If the image format is not supported, the image will be converted to 8-bit unsigned (CV_8U) and saved that way. If the format, depth or channel order is different, use Mat::convertTo and cv::cvtColor to convert it before saving. Or, use the universal FileStorage I/O functions to save the image to XML or YAML format. The sample below shows how to create a BGRA image, how to set custom compression parameters and save it to a PNG file. It also demonstrates how to save multiple images in a TIFF file: @include snippets/imgcodecs_imwrite.cpp

Python prototype (for reference):

imwrite(filename, img[, params]) -> retval
Link to this function

imwritemulti(filename, img)

View Source
Positional Arguments
  • filename: String
  • img: vector_UMat
Keyword Arguments
  • params: vector_int.

Python prototype (for reference):

imwritemulti(filename, img[, params]) -> retval
Link to this function

imwritemulti(filename, img, opts)

View Source
Positional Arguments
  • filename: String
  • img: vector_UMat
Keyword Arguments
  • params: vector_int.

Python prototype (for reference):

imwritemulti(filename, img[, params]) -> retval
Link to this function

initCameraMatrix2D(objectPoints, imagePoints, imageSize)

View Source
Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints: vector_UMat.
  • imageSize: Size.
Keyword Arguments
  • aspectRatio: double.

Finds an initial camera intrinsic matrix from 3D-2D point correspondences.

coordinate space. In the old interface all the per-view vectors are concatenated. See
#calibrateCamera for details.
old interface all the per-view vectors are concatenated.
Otherwise, \f$f\_x = f\_y \* \texttt{aspectRatio}\f$ .

The function estimates and returns an initial camera intrinsic matrix for the camera calibration process. Currently, the function only supports planar calibration patterns, which are patterns where each object point has z-coordinate =0.

Python prototype (for reference):

initCameraMatrix2D(objectPoints, imagePoints, imageSize[, aspectRatio]) -> retval
Link to this function

initCameraMatrix2D(objectPoints, imagePoints, imageSize, opts)

View Source
Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints: vector_UMat.
  • imageSize: Size.
Keyword Arguments
  • aspectRatio: double.

Finds an initial camera intrinsic matrix from 3D-2D point correspondences.

coordinate space. In the old interface all the per-view vectors are concatenated. See
#calibrateCamera for details.
old interface all the per-view vectors are concatenated.
Otherwise, \f$f\_x = f\_y \* \texttt{aspectRatio}\f$ .

The function estimates and returns an initial camera intrinsic matrix for the camera calibration process. Currently, the function only supports planar calibration patterns, which are patterns where each object point has z-coordinate =0.

Python prototype (for reference):

initCameraMatrix2D(objectPoints, imagePoints, imageSize[, aspectRatio]) -> retval
Link to this function

initInverseRectificationMap(cameraMatrix, distCoeffs, r, newCameraMatrix, size, m1type)

View Source
Positional Arguments
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • r: UMat.
  • newCameraMatrix: UMat.
  • size: Size.
  • m1type: int.
Keyword Arguments
  • map1: UMat.
  • map2: UMat.

Computes the projection and inverse-rectification transformation map. In essense, this is the inverse of #initUndistortRectifyMap to accomodate stereo-rectification of projectors ('inverse-cameras') in projector-camera pairs. The function computes the joint projection and inverse rectification transformation and represents the result in the form of maps for #remap. The projected image looks like a distorted version of the original which, once projected by a projector, should visually match the original. In case of a monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by #getOptimalNewCameraMatrix for a better control over scaling. In case of a projector-camera pair, newCameraMatrix is normally set to P1 or P2 computed by #stereoRectify . The projector is oriented differently in the coordinate space, according to R. In case of projector-camera pairs, this helps align the projector (in the same manner as #initUndistortRectifyMap for the camera) to create a stereo-rectified pair. This allows epipolar lines on both images to become horizontal and have the same y-coordinate (in case of a horizontally aligned projector-camera pair). The function builds the maps for the inverse mapping algorithm that is used by #remap. That is, for each pixel \f$(u, v)\f$ in the destination (projected and inverse-rectified) image, the function computes the corresponding coordinates in the source image (that is, in the original digital image). The following process is applied: \f[ \begin{array}{l} \text{newCameraMatrix}\\ x \leftarrow (u - {c'}_x)/{f'}_x \\ y \leftarrow (v - {c'}_y)/{f'}_y \\ \\\text{Undistortion} \\\scriptsize{\textit{though equation shown is for radial undistortion, function implements cv::undistortPoints()}}\\ r^2 \leftarrow x^2 + y^2 \\ \theta \leftarrow \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6}\\ x' \leftarrow \frac{x}{\theta} \\ y' \leftarrow \frac{y}{\theta} \\ \\\text{Rectification}\\ {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\ x'' \leftarrow X/W \\ y'' \leftarrow Y/W \\ \\\text{cameraMatrix}\\ map_x(u,v) \leftarrow x'' f_x + c_x \\ map_y(u,v) \leftarrow y'' f_y + c_y \end{array} \f] where \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ are the distortion coefficients vector distCoeffs. In case of a stereo-rectified projector-camera pair, this function is called for the projector while #initUndistortRectifyMap is called for the camera head. This is done after #stereoRectify, which in turn is called after #stereoCalibrate. If the projector-camera pair is not calibrated, it is still possible to compute the rectification transformations directly from the fundamental matrix using #stereoRectifyUncalibrated. For the projector and camera, the function computes homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D space. R can be computed from H as \f[\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}\f] where cameraMatrix can be chosen arbitrarily.

\f$(k\_1, k\_2, p\_1, p\_2\[, k\_3\[, k\_4, k\_5, k\_6\[, s\_1, s\_2, s\_3, s\_4\[, \tau\_x, \tau\_y]]]])\f$
of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
computed by #stereoRectify can be passed here. If the matrix is empty, the identity transformation
is assumed.

Python prototype (for reference):

initInverseRectificationMap(cameraMatrix, distCoeffs, R, newCameraMatrix, size, m1type[, map1[, map2]]) -> map1, map2
Link to this function

initInverseRectificationMap(cameraMatrix, distCoeffs, r, newCameraMatrix, size, m1type, opts)

View Source
Positional Arguments
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • r: UMat.
  • newCameraMatrix: UMat.
  • size: Size.
  • m1type: int.
Keyword Arguments
  • map1: UMat.
  • map2: UMat.

Computes the projection and inverse-rectification transformation map. In essense, this is the inverse of #initUndistortRectifyMap to accomodate stereo-rectification of projectors ('inverse-cameras') in projector-camera pairs. The function computes the joint projection and inverse rectification transformation and represents the result in the form of maps for #remap. The projected image looks like a distorted version of the original which, once projected by a projector, should visually match the original. In case of a monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by #getOptimalNewCameraMatrix for a better control over scaling. In case of a projector-camera pair, newCameraMatrix is normally set to P1 or P2 computed by #stereoRectify . The projector is oriented differently in the coordinate space, according to R. In case of projector-camera pairs, this helps align the projector (in the same manner as #initUndistortRectifyMap for the camera) to create a stereo-rectified pair. This allows epipolar lines on both images to become horizontal and have the same y-coordinate (in case of a horizontally aligned projector-camera pair). The function builds the maps for the inverse mapping algorithm that is used by #remap. That is, for each pixel \f$(u, v)\f$ in the destination (projected and inverse-rectified) image, the function computes the corresponding coordinates in the source image (that is, in the original digital image). The following process is applied: \f[ \begin{array}{l} \text{newCameraMatrix}\\ x \leftarrow (u - {c'}_x)/{f'}_x \\ y \leftarrow (v - {c'}_y)/{f'}_y \\ \\\text{Undistortion} \\\scriptsize{\textit{though equation shown is for radial undistortion, function implements cv::undistortPoints()}}\\ r^2 \leftarrow x^2 + y^2 \\ \theta \leftarrow \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6}\\ x' \leftarrow \frac{x}{\theta} \\ y' \leftarrow \frac{y}{\theta} \\ \\\text{Rectification}\\ {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\ x'' \leftarrow X/W \\ y'' \leftarrow Y/W \\ \\\text{cameraMatrix}\\ map_x(u,v) \leftarrow x'' f_x + c_x \\ map_y(u,v) \leftarrow y'' f_y + c_y \end{array} \f] where \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ are the distortion coefficients vector distCoeffs. In case of a stereo-rectified projector-camera pair, this function is called for the projector while #initUndistortRectifyMap is called for the camera head. This is done after #stereoRectify, which in turn is called after #stereoCalibrate. If the projector-camera pair is not calibrated, it is still possible to compute the rectification transformations directly from the fundamental matrix using #stereoRectifyUncalibrated. For the projector and camera, the function computes homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D space. R can be computed from H as \f[\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}\f] where cameraMatrix can be chosen arbitrarily.

\f$(k\_1, k\_2, p\_1, p\_2\[, k\_3\[, k\_4, k\_5, k\_6\[, s\_1, s\_2, s\_3, s\_4\[, \tau\_x, \tau\_y]]]])\f$
of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
computed by #stereoRectify can be passed here. If the matrix is empty, the identity transformation
is assumed.

Python prototype (for reference):

initInverseRectificationMap(cameraMatrix, distCoeffs, R, newCameraMatrix, size, m1type[, map1[, map2]]) -> map1, map2
Link to this function

initUndistortRectifyMap(cameraMatrix, distCoeffs, r, newCameraMatrix, size, m1type)

View Source
Positional Arguments
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • r: UMat.
  • newCameraMatrix: UMat.
  • size: Size.
  • m1type: int.
Keyword Arguments
  • map1: UMat.
  • map2: UMat.

Computes the undistortion and rectification transformation map. The function computes the joint undistortion and rectification transformation and represents the result in the form of maps for #remap. The undistorted image looks like original, as if it is captured with a camera using the camera matrix =newCameraMatrix and zero distortion. In case of a monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by #getOptimalNewCameraMatrix for a better control over scaling. In case of a stereo camera, newCameraMatrix is normally set to P1 or P2 computed by #stereoRectify . Also, this new camera is oriented differently in the coordinate space, according to R. That, for example, helps to align two heads of a stereo camera so that the epipolar lines on both images become horizontal and have the same y- coordinate (in case of a horizontally aligned stereo camera). The function actually builds the maps for the inverse mapping algorithm that is used by #remap. That is, for each pixel \f$(u, v)\f$ in the destination (corrected and rectified) image, the function computes the corresponding coordinates in the source image (that is, in the original image from camera). The following process is applied: \f[ \begin{array}{l} x \leftarrow (u - {c'}_x)/{f'}_x \\ y \leftarrow (v - {c'}_y)/{f'}_y \\ {[X\,Y\,W]} ^T \leftarrow R^{-1}*[x \, y \, 1]^T \\ x' \leftarrow X/W \\ y' \leftarrow Y/W \\ r^2 \leftarrow x'^2 + y'^2 \\ x'' \leftarrow x' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + 2p_1 x' y' + p_2(r^2 + 2 x'^2) + s_1 r^2 + s_2 r^4\\ y'' \leftarrow y' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' + s_3 r^2 + s_4 r^4 \\ s\vecthree{x'''}{y'''}{1} = \vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}((\tau_x, \tau_y)} {0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)} {0}{0}{1} R(\tau_x, \tau_y) \vecthree{x''}{y''}{1}\\ map_x(u,v) \leftarrow x''' f_x + c_x \\ map_y(u,v) \leftarrow y''' f_y + c_y \end{array} \f] where \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ are the distortion coefficients. In case of a stereo camera, this function is called twice: once for each camera head, after #stereoRectify, which in its turn is called after #stereoCalibrate. But if the stereo camera was not calibrated, it is still possible to compute the rectification transformations directly from the fundamental matrix using #stereoRectifyUncalibrated. For each camera, the function computes homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D space. R can be computed from H as \f[\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}\f] where cameraMatrix can be chosen arbitrarily.

\f$(k\_1, k\_2, p\_1, p\_2\[, k\_3\[, k\_4, k\_5, k\_6\[, s\_1, s\_2, s\_3, s\_4\[, \tau\_x, \tau\_y]]]])\f$
of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
computed by #stereoRectify can be passed here. If the matrix is empty, the identity transformation
is assumed. In cvInitUndistortMap R assumed to be an identity matrix.

Python prototype (for reference):

initUndistortRectifyMap(cameraMatrix, distCoeffs, R, newCameraMatrix, size, m1type[, map1[, map2]]) -> map1, map2
Link to this function

initUndistortRectifyMap(cameraMatrix, distCoeffs, r, newCameraMatrix, size, m1type, opts)

View Source
Positional Arguments
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • r: UMat.
  • newCameraMatrix: UMat.
  • size: Size.
  • m1type: int.
Keyword Arguments
  • map1: UMat.
  • map2: UMat.

Computes the undistortion and rectification transformation map. The function computes the joint undistortion and rectification transformation and represents the result in the form of maps for #remap. The undistorted image looks like original, as if it is captured with a camera using the camera matrix =newCameraMatrix and zero distortion. In case of a monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by #getOptimalNewCameraMatrix for a better control over scaling. In case of a stereo camera, newCameraMatrix is normally set to P1 or P2 computed by #stereoRectify . Also, this new camera is oriented differently in the coordinate space, according to R. That, for example, helps to align two heads of a stereo camera so that the epipolar lines on both images become horizontal and have the same y- coordinate (in case of a horizontally aligned stereo camera). The function actually builds the maps for the inverse mapping algorithm that is used by #remap. That is, for each pixel \f$(u, v)\f$ in the destination (corrected and rectified) image, the function computes the corresponding coordinates in the source image (that is, in the original image from camera). The following process is applied: \f[ \begin{array}{l} x \leftarrow (u - {c'}_x)/{f'}_x \\ y \leftarrow (v - {c'}_y)/{f'}_y \\ {[X\,Y\,W]} ^T \leftarrow R^{-1}*[x \, y \, 1]^T \\ x' \leftarrow X/W \\ y' \leftarrow Y/W \\ r^2 \leftarrow x'^2 + y'^2 \\ x'' \leftarrow x' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + 2p_1 x' y' + p_2(r^2 + 2 x'^2) + s_1 r^2 + s_2 r^4\\ y'' \leftarrow y' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' + s_3 r^2 + s_4 r^4 \\ s\vecthree{x'''}{y'''}{1} = \vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}((\tau_x, \tau_y)} {0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)} {0}{0}{1} R(\tau_x, \tau_y) \vecthree{x''}{y''}{1}\\ map_x(u,v) \leftarrow x''' f_x + c_x \\ map_y(u,v) \leftarrow y''' f_y + c_y \end{array} \f] where \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ are the distortion coefficients. In case of a stereo camera, this function is called twice: once for each camera head, after #stereoRectify, which in its turn is called after #stereoCalibrate. But if the stereo camera was not calibrated, it is still possible to compute the rectification transformations directly from the fundamental matrix using #stereoRectifyUncalibrated. For each camera, the function computes homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D space. R can be computed from H as \f[\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}\f] where cameraMatrix can be chosen arbitrarily.

\f$(k\_1, k\_2, p\_1, p\_2\[, k\_3\[, k\_4, k\_5, k\_6\[, s\_1, s\_2, s\_3, s\_4\[, \tau\_x, \tau\_y]]]])\f$
of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
computed by #stereoRectify can be passed here. If the matrix is empty, the identity transformation
is assumed. In cvInitUndistortMap R assumed to be an identity matrix.

Python prototype (for reference):

initUndistortRectifyMap(cameraMatrix, distCoeffs, R, newCameraMatrix, size, m1type[, map1[, map2]]) -> map1, map2
Link to this function

inpaint(src, inpaintMask, inpaintRadius, flags)

View Source
Positional Arguments
  • src: UMat.
  • inpaintMask: UMat.
  • inpaintRadius: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Restores the selected region in an image using the region neighborhood.

needs to be inpainted.
by the algorithm.

The function reconstructs the selected image area from the pixel near the area boundary. The function may be used to remove dust and scratches from a scanned photo, or to remove undesirable objects from still images or video. See http://en.wikipedia.org/wiki/Inpainting for more details. Note:

  • An example using the inpainting technique can be found at opencv_source_code/samples/cpp/inpaint.cpp
  • (Python) An example using the inpainting technique can be found at opencv_source_code/samples/python/inpaint.py

Python prototype (for reference):

inpaint(src, inpaintMask, inpaintRadius, flags[, dst]) -> dst
Link to this function

inpaint(src, inpaintMask, inpaintRadius, flags, opts)

View Source
Positional Arguments
  • src: UMat.
  • inpaintMask: UMat.
  • inpaintRadius: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Restores the selected region in an image using the region neighborhood.

needs to be inpainted.
by the algorithm.

The function reconstructs the selected image area from the pixel near the area boundary. The function may be used to remove dust and scratches from a scanned photo, or to remove undesirable objects from still images or video. See http://en.wikipedia.org/wiki/Inpainting for more details. Note:

  • An example using the inpainting technique can be found at opencv_source_code/samples/cpp/inpaint.cpp
  • (Python) An example using the inpainting technique can be found at opencv_source_code/samples/python/inpaint.py

Python prototype (for reference):

inpaint(src, inpaintMask, inpaintRadius, flags[, dst]) -> dst
Link to this function

inRange(src, lowerb, upperb)

View Source
Positional Arguments
  • src: UMat.
  • lowerb: UMat.
  • upperb: UMat.
Keyword Arguments
  • dst: UMat.

Checks if array elements lie between the elements of two other arrays. The function checks the range as follows:

  • For every element of a single-channel input array: \f[\texttt{dst} (I)= \texttt{lowerb} (I)_0 \leq \texttt{src} (I)_0 \leq \texttt{upperb} (I)_0\f]
  • For two-channel arrays: \f[\texttt{dst} (I)= \texttt{lowerb} (I)_0 \leq \texttt{src} (I)_0 \leq \texttt{upperb} (I)_0 \land \texttt{lowerb} (I)_1 \leq \texttt{src} (I)_1 \leq \texttt{upperb} (I)_1\f]
  • and so forth. That is, dst (I) is set to 255 (all 1 -bits) if src (I) is within the specified 1D, 2D, 3D, ... box and 0 otherwise. When the lower and/or upper boundary parameters are scalars, the indexes (I) at lowerb and upperb in the above formulas should be omitted.

Python prototype (for reference):

inRange(src, lowerb, upperb[, dst]) -> dst
Link to this function

inRange(src, lowerb, upperb, opts)

View Source
Positional Arguments
  • src: UMat.
  • lowerb: UMat.
  • upperb: UMat.
Keyword Arguments
  • dst: UMat.

Checks if array elements lie between the elements of two other arrays. The function checks the range as follows:

  • For every element of a single-channel input array: \f[\texttt{dst} (I)= \texttt{lowerb} (I)_0 \leq \texttt{src} (I)_0 \leq \texttt{upperb} (I)_0\f]
  • For two-channel arrays: \f[\texttt{dst} (I)= \texttt{lowerb} (I)_0 \leq \texttt{src} (I)_0 \leq \texttt{upperb} (I)_0 \land \texttt{lowerb} (I)_1 \leq \texttt{src} (I)_1 \leq \texttt{upperb} (I)_1\f]
  • and so forth. That is, dst (I) is set to 255 (all 1 -bits) if src (I) is within the specified 1D, 2D, 3D, ... box and 0 otherwise. When the lower and/or upper boundary parameters are scalars, the indexes (I) at lowerb and upperb in the above formulas should be omitted.

Python prototype (for reference):

inRange(src, lowerb, upperb[, dst]) -> dst
Link to this function

insertChannel(src, dst, coi)

View Source

Inserts a single channel to dst (coi is 0-based index) @sa mixChannels, merge

Python prototype (for reference):

insertChannel(src, dst, coi) -> dst
Positional Arguments
  • src: UMat
Keyword Arguments
  • sum: UMat.
  • sqsum: UMat.
  • sdepth: int.
  • sqdepth: int.

Has overloading in C++

Python prototype (for reference):

integral2(src[, sum[, sqsum[, sdepth[, sqdepth]]]]) -> sum, sqsum
Positional Arguments
  • src: UMat
Keyword Arguments
  • sum: UMat.
  • sqsum: UMat.
  • sdepth: int.
  • sqdepth: int.

Has overloading in C++

Python prototype (for reference):

integral2(src[, sum[, sqsum[, sdepth[, sqdepth]]]]) -> sum, sqsum
Positional Arguments
  • src: UMat.
Keyword Arguments
  • sum: UMat.
  • sqsum: UMat.
  • tilted: UMat.
  • sdepth: int.
  • sqdepth: int.

Calculates the integral of an image. The function calculates one or more integral images for the source image as follows: \f[\texttt{sum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)\f] \f[\texttt{sqsum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)^2\f] \f[\texttt{tilted} (X,Y) = \sum _{y<Y,abs(x-X+1) \leq Y-y-1} \texttt{image} (x,y)\f] Using these integral images, you can calculate sum, mean, and standard deviation over a specific up-right or rotated rectangular region of the image in a constant time, for example: \f[\sum _{x_1 \leq x < x_2, \, y_1 \leq y < y_2} \texttt{image} (x,y) = \texttt{sum} (x_2,y_2)- \texttt{sum} (x_1,y_2)- \texttt{sum} (x_2,y_1)+ \texttt{sum} (x_1,y_1)\f] It makes possible to do a fast blurring or fast block correlation with a variable window size, for example. In case of multi-channel images, sums for each channel are accumulated independently. As a practical example, the next figure shows the calculation of the integral of a straight rectangle Rect(3,3,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the original image are shown, as well as the relative pixels in the integral images sum and tilted . integral calculation example

floating-point (64f) array.
the same data type as sum.
CV_64F.

Python prototype (for reference):

integral3(src[, sum[, sqsum[, tilted[, sdepth[, sqdepth]]]]]) -> sum, sqsum, tilted
Positional Arguments
  • src: UMat.
Keyword Arguments
  • sum: UMat.
  • sqsum: UMat.
  • tilted: UMat.
  • sdepth: int.
  • sqdepth: int.

Calculates the integral of an image. The function calculates one or more integral images for the source image as follows: \f[\texttt{sum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)\f] \f[\texttt{sqsum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)^2\f] \f[\texttt{tilted} (X,Y) = \sum _{y<Y,abs(x-X+1) \leq Y-y-1} \texttt{image} (x,y)\f] Using these integral images, you can calculate sum, mean, and standard deviation over a specific up-right or rotated rectangular region of the image in a constant time, for example: \f[\sum _{x_1 \leq x < x_2, \, y_1 \leq y < y_2} \texttt{image} (x,y) = \texttt{sum} (x_2,y_2)- \texttt{sum} (x_1,y_2)- \texttt{sum} (x_2,y_1)+ \texttt{sum} (x_1,y_1)\f] It makes possible to do a fast blurring or fast block correlation with a variable window size, for example. In case of multi-channel images, sums for each channel are accumulated independently. As a practical example, the next figure shows the calculation of the integral of a straight rectangle Rect(3,3,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the original image are shown, as well as the relative pixels in the integral images sum and tilted . integral calculation example

floating-point (64f) array.
the same data type as sum.
CV_64F.

Python prototype (for reference):

integral3(src[, sum[, sqsum[, tilted[, sdepth[, sqdepth]]]]]) -> sum, sqsum, tilted
Positional Arguments
  • src: UMat
Keyword Arguments
  • sum: UMat.
  • sdepth: int.

Has overloading in C++

Python prototype (for reference):

integral(src[, sum[, sdepth]]) -> sum
Positional Arguments
  • src: UMat
Keyword Arguments
  • sum: UMat.
  • sdepth: int.

Has overloading in C++

Python prototype (for reference):

integral(src[, sum[, sdepth]]) -> sum
Link to this function

intersectConvexConvex(p1, p2)

View Source
Positional Arguments
  • p1: UMat.
  • p2: UMat.
Keyword Arguments
  • p12: UMat.
  • handleNested: bool.

Finds intersection of two convex polygons

When false, no intersection is found. If the polygons share a side or the vertex of one polygon lies on an edge
of the other, they are not considered nested and an intersection will be found regardless of the value of handleNested.

@returns Absolute value of area of intersecting polygon Note: intersectConvexConvex doesn't confirm that both polygons are convex and will return invalid results if they aren't.

Python prototype (for reference):

intersectConvexConvex(p1, p2[, p12[, handleNested]]) -> retval, p12
Link to this function

intersectConvexConvex(p1, p2, opts)

View Source
Positional Arguments
  • p1: UMat.
  • p2: UMat.
Keyword Arguments
  • p12: UMat.
  • handleNested: bool.

Finds intersection of two convex polygons

When false, no intersection is found. If the polygons share a side or the vertex of one polygon lies on an edge
of the other, they are not considered nested and an intersection will be found regardless of the value of handleNested.

@returns Absolute value of area of intersecting polygon Note: intersectConvexConvex doesn't confirm that both polygons are convex and will return invalid results if they aren't.

Python prototype (for reference):

intersectConvexConvex(p1, p2[, p12[, handleNested]]) -> retval, p12
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Finds the inverse or pseudo-inverse of a matrix. The function cv::invert inverts the matrix src and stores the result in dst . When the matrix src is singular or non-square, the function calculates the pseudo-inverse matrix (the dst matrix) so that norm(src*dst - I) is minimal, where I is an identity matrix. In case of the #DECOMP_LU method, the function returns non-zero value if the inverse has been successfully calculated and 0 if src is singular. In case of the #DECOMP_SVD method, the function returns the inverse condition number of src (the ratio of the smallest singular value to the largest singular value) and 0 if src is singular. The SVD method calculates a pseudo-inverse matrix if src is singular. Similarly to #DECOMP_LU, the method #DECOMP_CHOLESKY works only with non-singular square matrices that should also be symmetrical and positively defined. In this case, the function stores the inverted matrix in dst and returns non-zero. Otherwise, it returns 0. @sa solve, SVD

Python prototype (for reference):

invert(src[, dst[, flags]]) -> retval, dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Finds the inverse or pseudo-inverse of a matrix. The function cv::invert inverts the matrix src and stores the result in dst . When the matrix src is singular or non-square, the function calculates the pseudo-inverse matrix (the dst matrix) so that norm(src*dst - I) is minimal, where I is an identity matrix. In case of the #DECOMP_LU method, the function returns non-zero value if the inverse has been successfully calculated and 0 if src is singular. In case of the #DECOMP_SVD method, the function returns the inverse condition number of src (the ratio of the smallest singular value to the largest singular value) and 0 if src is singular. The SVD method calculates a pseudo-inverse matrix if src is singular. Similarly to #DECOMP_LU, the method #DECOMP_CHOLESKY works only with non-singular square matrices that should also be symmetrical and positively defined. In this case, the function stores the inverted matrix in dst and returns non-zero. Otherwise, it returns 0. @sa solve, SVD

Python prototype (for reference):

invert(src[, dst[, flags]]) -> retval, dst
Link to this function

invertAffineTransform(m)

View Source
Positional Arguments
  • m: UMat.
Keyword Arguments
  • iM: UMat.

Inverts an affine transformation. The function computes an inverse affine transformation represented by \f$2 \times 3\f$ matrix M: \f[\begin{bmatrix} a_{11} & a_{12} & b_1 \\ a_{21} & a_{22} & b_2 \end{bmatrix}\f] The result is also a \f$2 \times 3\f$ matrix of the same type as M.

Python prototype (for reference):

invertAffineTransform(M[, iM]) -> iM
Link to this function

invertAffineTransform(m, opts)

View Source
Positional Arguments
  • m: UMat.
Keyword Arguments
  • iM: UMat.

Inverts an affine transformation. The function computes an inverse affine transformation represented by \f$2 \times 3\f$ matrix M: \f[\begin{bmatrix} a_{11} & a_{12} & b_1 \\ a_{21} & a_{22} & b_2 \end{bmatrix}\f] The result is also a \f$2 \times 3\f$ matrix of the same type as M.

Python prototype (for reference):

invertAffineTransform(M[, iM]) -> iM
Link to this function

isContourConvex(contour)

View Source

Tests a contour convexity. The function tests whether the input contour is convex or not. The contour must be simple, that is, without self-intersections. Otherwise, the function output is undefined.

Python prototype (for reference):

isContourConvex(contour) -> retval
Link to this function

kmeans(data, k, bestLabels, criteria, attempts, flags)

View Source
Positional Arguments
  • data: UMat.
  • k: int.
  • bestLabels: UMat.
  • criteria: TermCriteria.
  • attempts: int.
  • flags: int.
Keyword Arguments
  • centers: UMat.

Finds centers of clusters and groups input samples around the clusters. The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters and groups the input samples around the clusters. As an output, \f$\texttt{bestLabels}_i\f$ contains a 0-based cluster index for the sample stored in the \f$i^{th}\f$ row of the samples matrix. Note:

  • (Python) An example on K-means clustering can be found at opencv_source_code/samples/python/kmeans.py Examples of this array can be:
    • Mat points(count, 2, CV_32F);
    • Mat points(count, 1, CV_32FC2);
    • Mat points(1, count, CV_32FC2);
    • std::vector\<cv::Point2f> points(sampleCount); the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster centers moves by less than criteria.epsilon on some iteration, the algorithm stops. initial labellings. The algorithm returns the labels that yield the best compactness (see the last function parameter). @return The function returns the compactness measure that is computed as \f[\sum _i \| \texttt{samples} _i - \texttt{centers} _{ \texttt{labels} _i} \| ^2\f] after every attempt. The best (minimum) value is chosen and the corresponding labels and the compactness value are returned by the function. Basically, you can use only the core of the function, set the number of attempts to 1, initialize labels each time using a custom algorithm, pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best (most-compact) clustering.

Python prototype (for reference):

kmeans(data, K, bestLabels, criteria, attempts, flags[, centers]) -> retval, bestLabels, centers
Link to this function

kmeans(data, k, bestLabels, criteria, attempts, flags, opts)

View Source
Positional Arguments
  • data: UMat.
  • k: int.
  • bestLabels: UMat.
  • criteria: TermCriteria.
  • attempts: int.
  • flags: int.
Keyword Arguments
  • centers: UMat.

Finds centers of clusters and groups input samples around the clusters. The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters and groups the input samples around the clusters. As an output, \f$\texttt{bestLabels}_i\f$ contains a 0-based cluster index for the sample stored in the \f$i^{th}\f$ row of the samples matrix. Note:

  • (Python) An example on K-means clustering can be found at opencv_source_code/samples/python/kmeans.py Examples of this array can be:
    • Mat points(count, 2, CV_32F);
    • Mat points(count, 1, CV_32FC2);
    • Mat points(1, count, CV_32FC2);
    • std::vector\<cv::Point2f> points(sampleCount); the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster centers moves by less than criteria.epsilon on some iteration, the algorithm stops. initial labellings. The algorithm returns the labels that yield the best compactness (see the last function parameter). @return The function returns the compactness measure that is computed as \f[\sum _i \| \texttt{samples} _i - \texttt{centers} _{ \texttt{labels} _i} \| ^2\f] after every attempt. The best (minimum) value is chosen and the corresponding labels and the compactness value are returned by the function. Basically, you can use only the core of the function, set the number of attempts to 1, initialize labels each time using a custom algorithm, pass them with the ( flags = #KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best (most-compact) clustering.

Python prototype (for reference):

kmeans(data, K, bestLabels, criteria, attempts, flags[, centers]) -> retval, bestLabels, centers
Positional Arguments
  • src: UMat.
  • ddepth: int.
Keyword Arguments
  • dst: UMat.
  • ksize: int.
  • scale: double.
  • delta: double.
  • borderType: int.

Calculates the Laplacian of an image. The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator: \f[\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\f] This is done when ksize > 1. When ksize == 1, the Laplacian is computed by filtering the image with the following \f$3 \times 3\f$ aperture: \f[\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\f]

details. The size must be positive and odd.
applied. See #getDerivKernels for details.

@sa Sobel, Scharr

Python prototype (for reference):

Laplacian(src, ddepth[, dst[, ksize[, scale[, delta[, borderType]]]]]) -> dst
Link to this function

laplacian(src, ddepth, opts)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
Keyword Arguments
  • dst: UMat.
  • ksize: int.
  • scale: double.
  • delta: double.
  • borderType: int.

Calculates the Laplacian of an image. The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator: \f[\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\f] This is done when ksize > 1. When ksize == 1, the Laplacian is computed by filtering the image with the following \f$3 \times 3\f$ aperture: \f[\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\f]

details. The size must be positive and odd.
applied. See #getDerivKernels for details.

@sa Sobel, Scharr

Python prototype (for reference):

Laplacian(src, ddepth[, dst[, ksize[, scale[, delta[, borderType]]]]]) -> dst
Link to this function

line(img, pt1, pt2, color)

View Source
Positional Arguments
  • img: UMat. Image.
  • pt1: Point.
  • pt2: Point.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a line segment connecting two points. The function line draws the line segment between pt1 and pt2 points in the image. The line is clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased lines are drawn using Gaussian filtering.

Python prototype (for reference):

line(img, pt1, pt2, color[, thickness[, lineType[, shift]]]) -> img
Link to this function

line(img, pt1, pt2, color, opts)

View Source
Positional Arguments
  • img: UMat. Image.
  • pt1: Point.
  • pt2: Point.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a line segment connecting two points. The function line draws the line segment between pt1 and pt2 points in the image. The line is clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased lines are drawn using Gaussian filtering.

Python prototype (for reference):

line(img, pt1, pt2, color[, thickness[, lineType[, shift]]]) -> img
Link to this function

linearPolar(src, center, maxRadius, flags)

View Source
Positional Arguments
  • src: UMat.
  • center: Point2f.
  • maxRadius: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Remaps an image to polar coordinates space. @deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags) @internal Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image c)"): \f[\begin{array}{l} dst( \rho , \phi ) = src(x,y) \\ dst.size() \leftarrow src.size() \end{array}\f] where \f[\begin{array}{l} I = (dx,dy) = (x - center.x,y - center.y) \\ \rho = Kmag \cdot \texttt{magnitude} (I) ,\\ \phi = angle \cdot \texttt{angle} (I) \end{array}\f] and \f[\begin{array}{l} Kx = src.cols / maxRadius \\ Ky = src.rows / 2\Pi \end{array}\f] Note:

  • The function can not operate in-place.
  • To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. @sa cv::logPolar @endinternal

Python prototype (for reference):

linearPolar(src, center, maxRadius, flags[, dst]) -> dst
Link to this function

linearPolar(src, center, maxRadius, flags, opts)

View Source
Positional Arguments
  • src: UMat.
  • center: Point2f.
  • maxRadius: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Remaps an image to polar coordinates space. @deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags) @internal Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image c)"): \f[\begin{array}{l} dst( \rho , \phi ) = src(x,y) \\ dst.size() \leftarrow src.size() \end{array}\f] where \f[\begin{array}{l} I = (dx,dy) = (x - center.x,y - center.y) \\ \rho = Kmag \cdot \texttt{magnitude} (I) ,\\ \phi = angle \cdot \texttt{angle} (I) \end{array}\f] and \f[\begin{array}{l} Kx = src.cols / maxRadius \\ Ky = src.rows / 2\Pi \end{array}\f] Note:

  • The function can not operate in-place.
  • To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. @sa cv::logPolar @endinternal

Python prototype (for reference):

linearPolar(src, center, maxRadius, flags[, dst]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the natural logarithm of every array element. The function cv::log calculates the natural logarithm of every element of the input array: \f[\texttt{dst} (I) = \log (\texttt{src}(I)) \f] Output on zero, negative and special (NaN, Inf) values is undefined. @sa exp, cartToPolar, polarToCart, phase, pow, sqrt, magnitude

Python prototype (for reference):

log(src[, dst]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the natural logarithm of every array element. The function cv::log calculates the natural logarithm of every element of the input array: \f[\texttt{dst} (I) = \log (\texttt{src}(I)) \f] Output on zero, negative and special (NaN, Inf) values is undefined. @sa exp, cartToPolar, polarToCart, phase, pow, sqrt, magnitude

Python prototype (for reference):

log(src[, dst]) -> dst
Link to this function

logPolar(src, center, m, flags)

View Source
Positional Arguments
  • src: UMat.
  • center: Point2f.
  • m: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Remaps an image to semilog-polar coordinates space. @deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags+WARP_POLAR_LOG); @internal Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image d)"): \f[\begin{array}{l} dst( \rho , \phi ) = src(x,y) \\ dst.size() \leftarrow src.size() \end{array}\f] where \f[\begin{array}{l} I = (dx,dy) = (x - center.x,y - center.y) \\ \rho = M \cdot log_e(\texttt{magnitude} (I)) ,\\ \phi = Kangle \cdot \texttt{angle} (I) \\ \end{array}\f] and \f[\begin{array}{l} M = src.cols / log_e(maxRadius) \\ Kangle = src.rows / 2\Pi \\ \end{array}\f] The function emulates the human "foveal" vision and can be used for fast scale and rotation-invariant template matching, for object tracking and so forth. Note:

  • The function can not operate in-place.
  • To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. @sa cv::linearPolar @endinternal

Python prototype (for reference):

logPolar(src, center, M, flags[, dst]) -> dst
Link to this function

logPolar(src, center, m, flags, opts)

View Source
Positional Arguments
  • src: UMat.
  • center: Point2f.
  • m: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Remaps an image to semilog-polar coordinates space. @deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags+WARP_POLAR_LOG); @internal Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image d)"): \f[\begin{array}{l} dst( \rho , \phi ) = src(x,y) \\ dst.size() \leftarrow src.size() \end{array}\f] where \f[\begin{array}{l} I = (dx,dy) = (x - center.x,y - center.y) \\ \rho = M \cdot log_e(\texttt{magnitude} (I)) ,\\ \phi = Kangle \cdot \texttt{angle} (I) \\ \end{array}\f] and \f[\begin{array}{l} M = src.cols / log_e(maxRadius) \\ Kangle = src.rows / 2\Pi \\ \end{array}\f] The function emulates the human "foveal" vision and can be used for fast scale and rotation-invariant template matching, for object tracking and so forth. Note:

  • The function can not operate in-place.
  • To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. @sa cv::linearPolar @endinternal

Python prototype (for reference):

logPolar(src, center, M, flags[, dst]) -> dst
Positional Arguments
  • src: UMat.
  • lut: UMat.
Keyword Arguments
  • dst: UMat.

Performs a look-up table transform of an array. The function LUT fills the output array with values from the look-up table. Indices of the entries are taken from the input array. That is, the function processes each element of src as follows: \f[\texttt{dst} (I) \leftarrow \texttt{lut(src(I) + d)}\f] where \f[d = \fork{0}{if (\texttt{src}) has depth (\texttt{CV_8U})}{128}{if (\texttt{src}) has depth (\texttt{CV_8S})}\f]

either have a single channel (in this case the same table is used for all channels) or the same
number of channels as in the input array.

@sa convertScaleAbs, Mat::convertTo

Python prototype (for reference):

LUT(src, lut[, dst]) -> dst
Positional Arguments
  • src: UMat.
  • lut: UMat.
Keyword Arguments
  • dst: UMat.

Performs a look-up table transform of an array. The function LUT fills the output array with values from the look-up table. Indices of the entries are taken from the input array. That is, the function processes each element of src as follows: \f[\texttt{dst} (I) \leftarrow \texttt{lut(src(I) + d)}\f] where \f[d = \fork{0}{if (\texttt{src}) has depth (\texttt{CV_8U})}{128}{if (\texttt{src}) has depth (\texttt{CV_8S})}\f]

either have a single channel (in this case the same table is used for all channels) or the same
number of channels as in the input array.

@sa convertScaleAbs, Mat::convertTo

Python prototype (for reference):

LUT(src, lut[, dst]) -> dst
Positional Arguments
  • x: UMat.
  • y: UMat.
Keyword Arguments
  • magnitude: UMat.

Calculates the magnitude of 2D vectors. The function cv::magnitude calculates the magnitude of 2D vectors formed from the corresponding elements of x and y arrays: \f[\texttt{dst} (I) = \sqrt{\texttt{x}(I)^2 + \texttt{y}(I)^2}\f]

have the same size as x.

@sa cartToPolar, polarToCart, phase, sqrt

Python prototype (for reference):

magnitude(x, y[, magnitude]) -> magnitude
Positional Arguments
  • x: UMat.
  • y: UMat.
Keyword Arguments
  • magnitude: UMat.

Calculates the magnitude of 2D vectors. The function cv::magnitude calculates the magnitude of 2D vectors formed from the corresponding elements of x and y arrays: \f[\texttt{dst} (I) = \sqrt{\texttt{x}(I)^2 + \texttt{y}(I)^2}\f]

have the same size as x.

@sa cartToPolar, polarToCart, phase, sqrt

Python prototype (for reference):

magnitude(x, y[, magnitude]) -> magnitude
Link to this function

mahalanobis(v1, v2, icovar)

View Source

Calculates the Mahalanobis distance between two vectors. The function cv::Mahalanobis calculates and returns the weighted distance between two vectors: \f[d( \texttt{vec1} , \texttt{vec2} )= \sqrt{\sum_{i,j}{\texttt{icovar(i,j)}\cdot(\texttt{vec1}(I)-\texttt{vec2}(I))\cdot(\texttt{vec1(j)}-\texttt{vec2(j)})} }\f] The covariance matrix may be calculated using the #calcCovarMatrix function and then inverted using the invert function (preferably using the #DECOMP_SVD method, as the most accurate).

Python prototype (for reference):

Mahalanobis(v1, v2, icovar) -> retval
Link to this function

matchShapes(contour1, contour2, method, parameter)

View Source

Compares two shapes. The function compares two shapes. All three implemented methods use the Hu invariants (see #HuMoments)

Python prototype (for reference):

matchShapes(contour1, contour2, method, parameter) -> retval
Link to this function

matchTemplate(image, templ, method)

View Source
Positional Arguments
  • image: UMat.
  • templ: UMat.
  • method: int.
Keyword Arguments
  • result: UMat.
  • mask: UMat.

Compares a template against overlapped image regions. The function slides through image , compares the overlapped patches of size \f$w \times h\f$ against templ using the specified method and stores the comparison results in result . #TemplateMatchModes describes the formulae for the available comparison methods ( \f$I\f$ denotes image, \f$T\f$ template, \f$R\f$ result, \f$M\f$ the optional mask ). The summation is done over template and/or the image patch: \f$x' = 0...w-1, y' = 0...h-1\f$ After the function finishes the comparison, the best matches can be found as global minimums (when #TM_SQDIFF was used) or maximums (when #TM_CCORR or #TM_CCOEFF was used) using the #minMaxLoc function. In case of a color image, template summation in the numerator and each sum in the denominator is done over all of the channels and separate mean values are used for each channel. That is, the function can take a color template and a color image. The result will still be a single-channel image, which is easier to analyze.

data type.
is \f$W \times H\f$ and templ is \f$w \times h\f$ , then result is \f$(W-w+1) \times (H-h+1)\f$ .
of channels as template or only one channel, which is then used for all template and
image channels. If the data type is #CV_8U, the mask is interpreted as a binary mask,
meaning only elements where mask is nonzero are used and are kept unchanged independent
of the actual mask value (weight equals 1). For data tpye #CV_32F, the mask values are
used as weights. The exact formulas are documented in #TemplateMatchModes.

Python prototype (for reference):

matchTemplate(image, templ, method[, result[, mask]]) -> result
Link to this function

matchTemplate(image, templ, method, opts)

View Source
Positional Arguments
  • image: UMat.
  • templ: UMat.
  • method: int.
Keyword Arguments
  • result: UMat.
  • mask: UMat.

Compares a template against overlapped image regions. The function slides through image , compares the overlapped patches of size \f$w \times h\f$ against templ using the specified method and stores the comparison results in result . #TemplateMatchModes describes the formulae for the available comparison methods ( \f$I\f$ denotes image, \f$T\f$ template, \f$R\f$ result, \f$M\f$ the optional mask ). The summation is done over template and/or the image patch: \f$x' = 0...w-1, y' = 0...h-1\f$ After the function finishes the comparison, the best matches can be found as global minimums (when #TM_SQDIFF was used) or maximums (when #TM_CCORR or #TM_CCOEFF was used) using the #minMaxLoc function. In case of a color image, template summation in the numerator and each sum in the denominator is done over all of the channels and separate mean values are used for each channel. That is, the function can take a color template and a color image. The result will still be a single-channel image, which is easier to analyze.

data type.
is \f$W \times H\f$ and templ is \f$w \times h\f$ , then result is \f$(W-w+1) \times (H-h+1)\f$ .
of channels as template or only one channel, which is then used for all template and
image channels. If the data type is #CV_8U, the mask is interpreted as a binary mask,
meaning only elements where mask is nonzero are used and are kept unchanged independent
of the actual mask value (weight equals 1). For data tpye #CV_32F, the mask values are
used as weights. The exact formulas are documented in #TemplateMatchModes.

Python prototype (for reference):

matchTemplate(image, templ, method[, result[, mask]]) -> result
Positional Arguments
  • a: UMat.
  • b: UMat.
Keyword Arguments
  • dABdA: UMat.
  • dABdB: UMat.

Computes partial derivatives of the matrix product for each multiplied matrix.

\f$\texttt{A.rows\*B.cols} \times {A.rows\*A.cols}\f$ .
\f$\texttt{A.rows\*B.cols} \times {B.rows\*B.cols}\f$ .

The function computes partial derivatives of the elements of the matrix product \f$A*B\f$ with regard to the elements of each of the two input matrices. The function is used to compute the Jacobian matrices in #stereoCalibrate but can also be used in any other similar optimization function.

Python prototype (for reference):

matMulDeriv(A, B[, dABdA[, dABdB]]) -> dABdA, dABdB
Positional Arguments
  • a: UMat.
  • b: UMat.
Keyword Arguments
  • dABdA: UMat.
  • dABdB: UMat.

Computes partial derivatives of the matrix product for each multiplied matrix.

\f$\texttt{A.rows\*B.cols} \times {A.rows\*A.cols}\f$ .
\f$\texttt{A.rows\*B.cols} \times {B.rows\*B.cols}\f$ .

The function computes partial derivatives of the elements of the matrix product \f$A*B\f$ with regard to the elements of each of the two input matrices. The function is used to compute the Jacobian matrices in #stereoCalibrate but can also be used in any other similar optimization function.

Python prototype (for reference):

matMulDeriv(A, B[, dABdA[, dABdB]]) -> dABdA, dABdB
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates per-element maximum of two arrays or an array and a scalar. The function cv::max calculates the per-element maximum of two arrays: \f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{src2} (I))\f] or array and a scalar: \f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{value} )\f] @sa min, compare, inRange, minMaxLoc, @ref MatrixExpressions

Python prototype (for reference):

max(src1, src2[, dst]) -> dst
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates per-element maximum of two arrays or an array and a scalar. The function cv::max calculates the per-element maximum of two arrays: \f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{src2} (I))\f] or array and a scalar: \f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{value} )\f] @sa min, compare, inRange, minMaxLoc, @ref MatrixExpressions

Python prototype (for reference):

max(src1, src2[, dst]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • mask: UMat.

Calculates an average (mean) of array elements. The function cv::mean calculates the mean value M of array elements, independently for each channel, and return it: \f[\begin{array}{l} N = \sum _{I: \; \texttt{mask} (I) \ne 0} 1 \\ M_c = \left ( \sum _{I: \; \texttt{mask} (I) \ne 0}{ \texttt{mtx} (I)_c} \right )/N \end{array}\f] When all the mask elements are 0's, the function returns Scalar::all(0)

Scalar_ .

@sa countNonZero, meanStdDev, norm, minMaxLoc

Python prototype (for reference):

mean(src[, mask]) -> retval
Positional Arguments
  • src: UMat.
Keyword Arguments
  • mask: UMat.

Calculates an average (mean) of array elements. The function cv::mean calculates the mean value M of array elements, independently for each channel, and return it: \f[\begin{array}{l} N = \sum _{I: \; \texttt{mask} (I) \ne 0} 1 \\ M_c = \left ( \sum _{I: \; \texttt{mask} (I) \ne 0}{ \texttt{mtx} (I)_c} \right )/N \end{array}\f] When all the mask elements are 0's, the function returns Scalar::all(0)

Scalar_ .

@sa countNonZero, meanStdDev, norm, minMaxLoc

Python prototype (for reference):

mean(src[, mask]) -> retval
Link to this function

meanShift(probImage, window, criteria)

View Source

Finds an object on a back projection image.

returns
:   Number of iterations CAMSHIFT took to converge.
The function implements the iterative object search algorithm. It takes the input back projection of
an object and the initial position. The mass center in window of the back projection image is
computed and the search window center shifts to the mass center. The procedure is repeated until the
specified number of iterations criteria.maxCount is done or until the window center shifts by less
than criteria.epsilon. The algorithm is used inside CamShift and, unlike CamShift , the search
window size or orientation do not change during the search. You can simply pass the output of
calcBackProject to this function. But better results can be obtained if you pre-filter the back
projection and remove the noise. For example, you can do this by retrieving connected components
with findContours , throwing away contours with small area ( contourArea ), and rendering the
remaining contours with drawContours.

Python prototype (for reference):

meanShift(probImage, window, criteria) -> retval, window
Positional Arguments
  • src: UMat.
Keyword Arguments
  • mean: UMat.

  • stddev: UMat.

  • mask: UMat.

    Calculates a mean and standard deviation of array elements. The function cv::meanStdDev calculates the mean and the standard deviation M of array elements independently for each channel and returns it via the output parameters: \f[\begin{array}{l} N = \sum _{I, \texttt{mask} (I) \ne 0} 1 \\ \texttt{mean} _c = \frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \texttt{src} (I)_c}{N} \\ \texttt{stddev} _c = \sqrt{\frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \left ( \texttt{src} (I)_c - \texttt{mean} _c \right )^2}{N}} \end{array}\f] When all the mask elements are 0's, the function returns mean=stddev=Scalar::all(0).

Note: The calculated standard deviation is only the diagonal of the complete normalized covariance matrix. If the full matrix is needed, you can reshape the multi-channel array M x N to the single-channel array M*N x mtx.channels() (only possible when the matrix is continuous) and then pass the matrix to calcCovarMatrix .

Scalar_ 's.

@sa countNonZero, mean, norm, minMaxLoc, calcCovarMatrix

Python prototype (for reference):

meanStdDev(src[, mean[, stddev[, mask]]]) -> mean, stddev
Positional Arguments
  • src: UMat.
Keyword Arguments
  • mean: UMat.

  • stddev: UMat.

  • mask: UMat.

    Calculates a mean and standard deviation of array elements. The function cv::meanStdDev calculates the mean and the standard deviation M of array elements independently for each channel and returns it via the output parameters: \f[\begin{array}{l} N = \sum _{I, \texttt{mask} (I) \ne 0} 1 \\ \texttt{mean} _c = \frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \texttt{src} (I)_c}{N} \\ \texttt{stddev} _c = \sqrt{\frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \left ( \texttt{src} (I)_c - \texttt{mean} _c \right )^2}{N}} \end{array}\f] When all the mask elements are 0's, the function returns mean=stddev=Scalar::all(0).

Note: The calculated standard deviation is only the diagonal of the complete normalized covariance matrix. If the full matrix is needed, you can reshape the multi-channel array M x N to the single-channel array M*N x mtx.channels() (only possible when the matrix is continuous) and then pass the matrix to calcCovarMatrix .

Scalar_ 's.

@sa countNonZero, mean, norm, minMaxLoc, calcCovarMatrix

Python prototype (for reference):

meanStdDev(src[, mean[, stddev[, mask]]]) -> mean, stddev
Positional Arguments
  • src: UMat.
  • ksize: int.
Keyword Arguments
  • dst: UMat.

Blurs an image using the median filter. The function smoothes an image using the median filter with the \f$\texttt{ksize} \times \texttt{ksize}\f$ aperture. Each channel of a multi-channel image is processed independently. In-place operation is supported. Note: The median filter uses #BORDER_REPLICATE internally to cope with border pixels, see #BorderTypes

CV_8U, CV_16U, or CV_32F, for larger aperture sizes, it can only be CV_8U.

@sa bilateralFilter, blur, boxFilter, GaussianBlur

Python prototype (for reference):

medianBlur(src, ksize[, dst]) -> dst
Link to this function

medianBlur(src, ksize, opts)

View Source
Positional Arguments
  • src: UMat.
  • ksize: int.
Keyword Arguments
  • dst: UMat.

Blurs an image using the median filter. The function smoothes an image using the median filter with the \f$\texttt{ksize} \times \texttt{ksize}\f$ aperture. Each channel of a multi-channel image is processed independently. In-place operation is supported. Note: The median filter uses #BORDER_REPLICATE internally to cope with border pixels, see #BorderTypes

CV_8U, CV_16U, or CV_32F, for larger aperture sizes, it can only be CV_8U.

@sa bilateralFilter, blur, boxFilter, GaussianBlur

Python prototype (for reference):

medianBlur(src, ksize[, dst]) -> dst
Positional Arguments
  • mv: vector_UMat.
Keyword Arguments
  • dst: UMat.

Has overloading in C++

size and the same depth.
be the total number of channels in the matrix array.

Python prototype (for reference):

merge(mv[, dst]) -> dst
Positional Arguments
  • mv: vector_UMat.
Keyword Arguments
  • dst: UMat.

Has overloading in C++

size and the same depth.
be the total number of channels in the matrix array.

Python prototype (for reference):

merge(mv[, dst]) -> dst
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates per-element minimum of two arrays or an array and a scalar. The function cv::min calculates the per-element minimum of two arrays: \f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{src2} (I))\f] or array and a scalar: \f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{value} )\f] @sa max, compare, inRange, minMaxLoc

Python prototype (for reference):

min(src1, src2[, dst]) -> dst
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates per-element minimum of two arrays or an array and a scalar. The function cv::min calculates the per-element minimum of two arrays: \f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{src2} (I))\f] or array and a scalar: \f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{value} )\f] @sa max, compare, inRange, minMaxLoc

Python prototype (for reference):

min(src1, src2[, dst]) -> dst

Finds a rotated rectangle of the minimum area enclosing the input 2D point set. The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a specified point set. Developer should keep in mind that the returned RotatedRect can contain negative indices when data is close to the containing Mat element boundary.

Python prototype (for reference):

minAreaRect(points) -> retval
Link to this function

minEnclosingCircle(points)

View Source

Finds a circle of the minimum area enclosing a 2D point set. The function finds the minimal enclosing circle of a 2D point set using an iterative algorithm.

Python prototype (for reference):

minEnclosingCircle(points) -> center, radius
Link to this function

minEnclosingTriangle(points)

View Source
Positional Arguments
  • points: UMat.
Keyword Arguments
  • triangle: UMat.

Finds a triangle of minimum area enclosing a 2D point set and returns its area. The function finds a triangle of minimum area enclosing the given set of 2D points and returns its area. The output for a given 2D point set is shown in the image below. 2D points are depicted in red and the enclosing triangle in yellow*. Sample output of the minimum enclosing triangle function The implementation of the algorithm is based on O'Rourke's @cite ORourke86 and Klee and Laskowski's @cite KleeLaskowski85 papers. O'Rourke provides a \f$\theta(n)\f$ algorithm for finding the minimal enclosing triangle of a 2D convex polygon with n vertices. Since the #minEnclosingTriangle function takes a 2D point set as input an additional preprocessing step of computing the convex hull of the 2D point set is required. The complexity of the #convexHull function is \f$O(n log(n))\f$ which is higher than \f$\theta(n)\f$. Thus the overall complexity of the function is \f$O(n log(n))\f$.

of the OutputArray must be CV_32F.

Python prototype (for reference):

minEnclosingTriangle(points[, triangle]) -> retval, triangle
Link to this function

minEnclosingTriangle(points, opts)

View Source
Positional Arguments
  • points: UMat.
Keyword Arguments
  • triangle: UMat.

Finds a triangle of minimum area enclosing a 2D point set and returns its area. The function finds a triangle of minimum area enclosing the given set of 2D points and returns its area. The output for a given 2D point set is shown in the image below. 2D points are depicted in red and the enclosing triangle in yellow*. Sample output of the minimum enclosing triangle function The implementation of the algorithm is based on O'Rourke's @cite ORourke86 and Klee and Laskowski's @cite KleeLaskowski85 papers. O'Rourke provides a \f$\theta(n)\f$ algorithm for finding the minimal enclosing triangle of a 2D convex polygon with n vertices. Since the #minEnclosingTriangle function takes a 2D point set as input an additional preprocessing step of computing the convex hull of the 2D point set is required. The complexity of the #convexHull function is \f$O(n log(n))\f$ which is higher than \f$\theta(n)\f$. Thus the overall complexity of the function is \f$O(n log(n))\f$.

of the OutputArray must be CV_32F.

Python prototype (for reference):

minEnclosingTriangle(points[, triangle]) -> retval, triangle
Positional Arguments
  • src: UMat.
Keyword Arguments
  • mask: UMat.

Finds the global minimum and maximum in an array. The function cv::minMaxLoc finds the minimum and maximum element values and their positions. The extremums are searched across the whole array or, if mask is not an empty array, in the specified array region. The function do not work with multi-channel arrays. If you need to find minimum or maximum elements across all the channels, use Mat::reshape first to reinterpret the array as single-channel. Or you may extract the particular channel using either extractImageCOI , or mixChannels , or split . @sa max, min, reduceArgMin, reduceArgMax, compare, inRange, extractImageCOI, mixChannels, split, Mat::reshape

Python prototype (for reference):

minMaxLoc(src[, mask]) -> minVal, maxVal, minLoc, maxLoc
Positional Arguments
  • src: UMat.
Keyword Arguments
  • mask: UMat.

Finds the global minimum and maximum in an array. The function cv::minMaxLoc finds the minimum and maximum element values and their positions. The extremums are searched across the whole array or, if mask is not an empty array, in the specified array region. The function do not work with multi-channel arrays. If you need to find minimum or maximum elements across all the channels, use Mat::reshape first to reinterpret the array as single-channel. Or you may extract the particular channel using either extractImageCOI , or mixChannels , or split . @sa max, min, reduceArgMin, reduceArgMax, compare, inRange, extractImageCOI, mixChannels, split, Mat::reshape

Python prototype (for reference):

minMaxLoc(src[, mask]) -> minVal, maxVal, minLoc, maxLoc
Link to this function

mixChannels(src, dst, fromTo)

View Source

Has overloading in C++

same depth.
depth must be the same as in src[0].
a 0-based index of the input channel in src, fromTo[k\*2+1] is an index of the output channel in
dst; the continuous channel numbering is used: the first input image channels are indexed from 0 to
src[0].channels()-1, the second input image channels are indexed from src[0].channels() to
src[0].channels() + src[1].channels()-1, and so on, the same scheme is used for the output image
channels; as a special case, when fromTo[k\*2] is negative, the corresponding output channel is
filled with zero .

Python prototype (for reference):

mixChannels(src, dst, fromTo) -> dst
Positional Arguments
  • array: UMat.
Keyword Arguments
  • binaryImage: bool.

Calculates all of the moments up to the third order of a polygon or rasterized shape. The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The results are returned in the structure cv::Moments.

\f$1 \times N\f$ or \f$N \times 1\f$ ) of 2D points (Point or Point2f ).
used for images only.

@returns moments. Note: Only applicable to contour moments calculations from Python bindings: Note that the numpy type for the input array should be either np.int32 or np.float32. @sa contourArea, arcLength

Python prototype (for reference):

moments(array[, binaryImage]) -> retval
Positional Arguments
  • array: UMat.
Keyword Arguments
  • binaryImage: bool.

Calculates all of the moments up to the third order of a polygon or rasterized shape. The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The results are returned in the structure cv::Moments.

\f$1 \times N\f$ or \f$N \times 1\f$ ) of 2D points (Point or Point2f ).
used for images only.

@returns moments. Note: Only applicable to contour moments calculations from Python bindings: Note that the numpy type for the input array should be either np.int32 or np.float32. @sa contourArea, arcLength

Python prototype (for reference):

moments(array[, binaryImage]) -> retval
Link to this function

morphologyEx(src, op, kernel)

View Source
Positional Arguments
  • src: UMat.
  • op: int.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • iterations: int.
  • borderType: int.
  • borderValue: Scalar.

Performs advanced morphological transformations. The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as basic operations. Any of the operations can be done in-place. In case of multi-channel images, each channel is processed independently.

CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
kernel center.
meaning.

@sa dilate, erode, getStructuringElement Note: The number of iterations is the number of times erosion or dilatation operation will be applied. For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply successively: erode -> erode -> dilate -> dilate (and not erode -> dilate -> erode -> dilate).

Python prototype (for reference):

morphologyEx(src, op, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst
Link to this function

morphologyEx(src, op, kernel, opts)

View Source
Positional Arguments
  • src: UMat.
  • op: int.
  • kernel: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • iterations: int.
  • borderType: int.
  • borderValue: Scalar.

Performs advanced morphological transformations. The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as basic operations. Any of the operations can be done in-place. In case of multi-channel images, each channel is processed independently.

CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
kernel center.
meaning.

@sa dilate, erode, getStructuringElement Note: The number of iterations is the number of times erosion or dilatation operation will be applied. For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply successively: erode -> erode -> dilate -> dilate (and not erode -> dilate -> erode -> dilate).

Python prototype (for reference):

morphologyEx(src, op, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst
Link to this function

moveWindow(winname, x, y)

View Source

Moves the window to the specified position

Python prototype (for reference):

moveWindow(winname, x, y) -> None
Link to this function

mulSpectrums(a, b, flags)

View Source
Positional Arguments
  • a: UMat.
  • b: UMat.
  • flags: int.
Keyword Arguments
  • c: UMat.
  • conjB: bool.

Performs the per-element multiplication of two Fourier spectrums. The function cv::mulSpectrums performs the per-element multiplication of the two CCS-packed or complex matrices that are results of a real or complex Fourier transform. The function, together with dft and idft , may be used to calculate convolution (pass conjB=false ) or correlation (pass conjB=true ) of two arrays rapidly. When the arrays are complex, they are simply multiplied (per element) with an optional conjugation of the second-array elements. When the arrays are real, they are assumed to be CCS-packed (see dft for details).

each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a `0` as value.
or not (false).

Python prototype (for reference):

mulSpectrums(a, b, flags[, c[, conjB]]) -> c
Link to this function

mulSpectrums(a, b, flags, opts)

View Source
Positional Arguments
  • a: UMat.
  • b: UMat.
  • flags: int.
Keyword Arguments
  • c: UMat.
  • conjB: bool.

Performs the per-element multiplication of two Fourier spectrums. The function cv::mulSpectrums performs the per-element multiplication of the two CCS-packed or complex matrices that are results of a real or complex Fourier transform. The function, together with dft and idft , may be used to calculate convolution (pass conjB=false ) or correlation (pass conjB=true ) of two arrays rapidly. When the arrays are complex, they are simply multiplied (per element) with an optional conjugation of the second-array elements. When the arrays are real, they are assumed to be CCS-packed (see dft for details).

each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a `0` as value.
or not (false).

Python prototype (for reference):

mulSpectrums(a, b, flags[, c[, conjB]]) -> c
Positional Arguments
  • src: UMat.
  • aTa: bool.
Keyword Arguments
  • dst: UMat.
  • delta: UMat.
  • scale: double.
  • dtype: int.

Calculates the product of a matrix and its transposition. The function cv::mulTransposed calculates the product of src and its transposition: \f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\f] if aTa=true , and \f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\f] otherwise. The function is used to calculate the covariance matrix. With zero delta, it can be used as a faster substitute for general matrix product A*B when B=A'

function can multiply not only floating-point matrices.
description below.
multiplication. When the matrix is empty ( delta=noArray() ), it is
assumed to be zero, that is, nothing is subtracted. If it has the same
size as src , it is simply subtracted. Otherwise, it is "repeated" (see
repeat ) to cover the full src and then subtracted. Type of the delta
matrix, when it is not empty, must be the same as the type of created
output matrix. See the dtype parameter description below.
the output matrix will have the same type as src . Otherwise, it will be
type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F .

@sa calcCovarMatrix, gemm, repeat, reduce

Python prototype (for reference):

mulTransposed(src, aTa[, dst[, delta[, scale[, dtype]]]]) -> dst
Link to this function

mulTransposed(src, aTa, opts)

View Source
Positional Arguments
  • src: UMat.
  • aTa: bool.
Keyword Arguments
  • dst: UMat.
  • delta: UMat.
  • scale: double.
  • dtype: int.

Calculates the product of a matrix and its transposition. The function cv::mulTransposed calculates the product of src and its transposition: \f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\f] if aTa=true , and \f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\f] otherwise. The function is used to calculate the covariance matrix. With zero delta, it can be used as a faster substitute for general matrix product A*B when B=A'

function can multiply not only floating-point matrices.
description below.
multiplication. When the matrix is empty ( delta=noArray() ), it is
assumed to be zero, that is, nothing is subtracted. If it has the same
size as src , it is simply subtracted. Otherwise, it is "repeated" (see
repeat ) to cover the full src and then subtracted. Type of the delta
matrix, when it is not empty, must be the same as the type of created
output matrix. See the dtype parameter description below.
the output matrix will have the same type as src . Otherwise, it will be
type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F .

@sa calcCovarMatrix, gemm, repeat, reduce

Python prototype (for reference):

mulTransposed(src, aTa[, dst[, delta[, scale[, dtype]]]]) -> dst
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • scale: double.
  • dtype: int.

Calculates the per-element scaled product of two arrays. The function multiply calculates the per-element product of two arrays: \f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I) \cdot \texttt{src2} (I))\f] There is also a @ref MatrixExpressions -friendly variant of the first function. See Mat::mul . For a not-per-element matrix product, see gemm . Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow. @sa add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare, Mat::convertTo

Python prototype (for reference):

multiply(src1, src2[, dst[, scale[, dtype]]]) -> dst
Link to this function

multiply(src1, src2, opts)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • scale: double.
  • dtype: int.

Calculates the per-element scaled product of two arrays. The function multiply calculates the per-element product of two arrays: \f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I) \cdot \texttt{src2} (I))\f] There is also a @ref MatrixExpressions -friendly variant of the first function. See Mat::mul . For a not-per-element matrix product, see gemm . Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow. @sa add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare, Mat::convertTo

Python prototype (for reference):

multiply(src1, src2[, dst[, scale[, dtype]]]) -> dst
Positional Arguments
  • winname: String.
Keyword Arguments
  • flags: int.

Creates a window. The function namedWindow creates a window that can be used as a placeholder for images and trackbars. Created windows are referred to by their names. If a window with the same name already exists, the function does nothing. You can call cv::destroyWindow or cv::destroyAllWindows to close the window and de-allocate any associated memory usage. For a simple program, you do not really have to call these functions because all the resources and windows of the application are closed automatically by the operating system upon exit. Note: Qt backend supports additional flags:

  • WINDOW_NORMAL or WINDOW_AUTOSIZE: WINDOW_NORMAL enables you to resize the window, whereas WINDOW_AUTOSIZE adjusts automatically the window size to fit the displayed image (see imshow ), and you cannot change the window size manually.
  • WINDOW_FREERATIO or WINDOW_KEEPRATIO: WINDOW_FREERATIO adjusts the image with no respect to its ratio, whereas WINDOW_KEEPRATIO keeps the image ratio.
  • WINDOW_GUI_NORMAL or WINDOW_GUI_EXPANDED: WINDOW_GUI_NORMAL is the old way to draw the window without statusbar and toolbar, whereas WINDOW_GUI_EXPANDED is a new enhanced GUI. By default, flags == WINDOW_AUTOSIZE | WINDOW_KEEPRATIO | WINDOW_GUI_EXPANDED

Python prototype (for reference):

namedWindow(winname[, flags]) -> None
Link to this function

namedWindow(winname, opts)

View Source
Positional Arguments
  • winname: String.
Keyword Arguments
  • flags: int.

Creates a window. The function namedWindow creates a window that can be used as a placeholder for images and trackbars. Created windows are referred to by their names. If a window with the same name already exists, the function does nothing. You can call cv::destroyWindow or cv::destroyAllWindows to close the window and de-allocate any associated memory usage. For a simple program, you do not really have to call these functions because all the resources and windows of the application are closed automatically by the operating system upon exit. Note: Qt backend supports additional flags:

  • WINDOW_NORMAL or WINDOW_AUTOSIZE: WINDOW_NORMAL enables you to resize the window, whereas WINDOW_AUTOSIZE adjusts automatically the window size to fit the displayed image (see imshow ), and you cannot change the window size manually.
  • WINDOW_FREERATIO or WINDOW_KEEPRATIO: WINDOW_FREERATIO adjusts the image with no respect to its ratio, whereas WINDOW_KEEPRATIO keeps the image ratio.
  • WINDOW_GUI_NORMAL or WINDOW_GUI_EXPANDED: WINDOW_GUI_NORMAL is the old way to draw the window without statusbar and toolbar, whereas WINDOW_GUI_EXPANDED is a new enhanced GUI. By default, flags == WINDOW_AUTOSIZE | WINDOW_KEEPRATIO | WINDOW_GUI_EXPANDED

Python prototype (for reference):

namedWindow(winname[, flags]) -> None
Positional Arguments
  • src1: UMat.
Keyword Arguments
  • normType: int.
  • mask: UMat.

Calculates the absolute norm of an array. This version of #norm calculates the absolute norm of src1. The type of norm to calculate is specified using #NormTypes. As example for one array consider the function \f$r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\f$. The \f$ L_{1}, L_{2} \f$ and \f$ L_{\infty} \f$ norm for the sample value \f$r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\f$ is calculated as follows \f{align} \| r(-1) \|{L_1} &= |-1| + |2| = 3 \\ \| r(-1) \|{L2} &= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\ \| r(-1) \|{L_\infty} &= \max(|-1|,|2|) = 2 \f} and for \f$r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\f$ the calculation is \f{align} \| r(0.5) \|{L_1} &= |0.5| + |0.5| = 1 \\ \| r(0.5) \|{L2} &= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\ \| r(0.5) \|{L\infty} &= \max(|0.5|,|0.5|) = 0.5. \f} The following graphic shows all values for the three norm functions \f$\| r(x) \|\{L_1}, \| r(x) \|_{L_2}\f$ and \f$\| r(x) \|_{L_\infty}\f$. It is notable that the \f$ L_{1} \f$ norm forms the upper and the \f$ L_{\infty} \f$ norm forms the lower border for the example function \f$ r(x) \f$. Graphs for the different norm functions from the above example When the mask parameter is specified and it is not empty, the norm is If normType is not specified, #NORM_L2 is used. calculated only over the region specified by the mask. Multi-channel input arrays are treated as single-channel arrays, that is, the results for all channels are combined. Hamming norms can only be calculated with CV_8U depth arrays.

Python prototype (for reference):

norm(src1[, normType[, mask]]) -> retval

Variaint 1:

Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • normType: int.
  • mask: UMat.

Calculates an absolute difference norm or a relative difference norm. This version of cv::norm calculates the absolute difference norm or the relative difference norm of arrays src1 and src2. The type of norm to calculate is specified using #NormTypes.

Python prototype (for reference):

norm(src1, src2[, normType[, mask]]) -> retval

Variaint 2:

Positional Arguments
  • src1: UMat.
Keyword Arguments
  • normType: int.
  • mask: UMat.

Calculates the absolute norm of an array. This version of #norm calculates the absolute norm of src1. The type of norm to calculate is specified using #NormTypes. As example for one array consider the function \f$r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\f$. The \f$ L_{1}, L_{2} \f$ and \f$ L_{\infty} \f$ norm for the sample value \f$r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\f$ is calculated as follows \f{align} \| r(-1) \|{L_1} &= |-1| + |2| = 3 \\ \| r(-1) \|{L2} &= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\ \| r(-1) \|{L_\infty} &= \max(|-1|,|2|) = 2 \f} and for \f$r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\f$ the calculation is \f{align} \| r(0.5) \|{L_1} &= |0.5| + |0.5| = 1 \\ \| r(0.5) \|{L2} &= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\ \| r(0.5) \|{L\infty} &= \max(|0.5|,|0.5|) = 0.5. \f} The following graphic shows all values for the three norm functions \f$\| r(x) \|\{L_1}, \| r(x) \|_{L_2}\f$ and \f$\| r(x) \|_{L_\infty}\f$. It is notable that the \f$ L_{1} \f$ norm forms the upper and the \f$ L_{\infty} \f$ norm forms the lower border for the example function \f$ r(x) \f$. Graphs for the different norm functions from the above example When the mask parameter is specified and it is not empty, the norm is If normType is not specified, #NORM_L2 is used. calculated only over the region specified by the mask. Multi-channel input arrays are treated as single-channel arrays, that is, the results for all channels are combined. Hamming norms can only be calculated with CV_8U depth arrays.

Python prototype (for reference):

norm(src1[, normType[, mask]]) -> retval
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • normType: int.
  • mask: UMat.

Calculates an absolute difference norm or a relative difference norm. This version of cv::norm calculates the absolute difference norm or the relative difference norm of arrays src1 and src2. The type of norm to calculate is specified using #NormTypes.

Python prototype (for reference):

norm(src1, src2[, normType[, mask]]) -> retval
Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • alpha: double.
  • beta: double.
  • norm_type: int.
  • dtype: int.
  • mask: UMat.

Normalizes the norm or value range of an array. The function cv::normalize normalizes scale and shift the input array elements so that \f[\| \texttt{dst} \| _{L_p}= \texttt{alpha}\f] (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that \f[\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\f] when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or min-max but modify the whole array, you can use norm and Mat::convertTo. In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this, the range transformation for sparse matrices is not allowed since it can shift the zero level. Possible usage with some positive example data:

vector<double> positiveData = { 2.0, 8.0, 10.0 };
vector<double> normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
// Norm to probability (total count)
// sum(numbers) = 20.0
// 2.0      0.1     (2.0/20.0)
// 8.0      0.4     (8.0/20.0)
// 10.0     0.5     (10.0/20.0)
normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
// Norm to unit vector: ||positiveData|| = 1.0
// 2.0      0.15
// 8.0      0.62
// 10.0     0.77
normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
// Norm to max element
// 2.0      0.2     (2.0/10.0)
// 8.0      0.8     (8.0/10.0)
// 10.0     1.0     (10.0/10.0)
normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
// Norm to range [0.0;1.0]
// 2.0      0.0     (shift to left border)
// 8.0      0.75    (6.0/8.0)
// 10.0     1.0     (shift to right border)
normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
normalization.
normalization.
number of channels as src and the depth =CV_MAT_DEPTH(dtype).

@sa norm, Mat::convertTo, SparseMat::convertTo

Python prototype (for reference):

normalize(src, dst[, alpha[, beta[, norm_type[, dtype[, mask]]]]]) -> dst
Link to this function

normalize(src, dst, opts)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
Keyword Arguments
  • alpha: double.
  • beta: double.
  • norm_type: int.
  • dtype: int.
  • mask: UMat.

Normalizes the norm or value range of an array. The function cv::normalize normalizes scale and shift the input array elements so that \f[\| \texttt{dst} \| _{L_p}= \texttt{alpha}\f] (where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that \f[\min _I \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I \texttt{dst} (I)= \texttt{beta}\f] when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or min-max but modify the whole array, you can use norm and Mat::convertTo. In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this, the range transformation for sparse matrices is not allowed since it can shift the zero level. Possible usage with some positive example data:

vector<double> positiveData = { 2.0, 8.0, 10.0 };
vector<double> normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
// Norm to probability (total count)
// sum(numbers) = 20.0
// 2.0      0.1     (2.0/20.0)
// 8.0      0.4     (8.0/20.0)
// 10.0     0.5     (10.0/20.0)
normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
// Norm to unit vector: ||positiveData|| = 1.0
// 2.0      0.15
// 8.0      0.62
// 10.0     0.77
normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
// Norm to max element
// 2.0      0.2     (2.0/10.0)
// 8.0      0.8     (8.0/10.0)
// 10.0     1.0     (10.0/10.0)
normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
// Norm to range [0.0;1.0]
// 2.0      0.0     (shift to left border)
// 8.0      0.75    (6.0/8.0)
// 10.0     1.0     (shift to right border)
normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
normalization.
normalization.
number of channels as src and the depth =CV_MAT_DEPTH(dtype).

@sa norm, Mat::convertTo, SparseMat::convertTo

Python prototype (for reference):

normalize(src, dst[, alpha[, beta[, norm_type[, dtype[, mask]]]]]) -> dst
Positional Arguments
  • a: UMat.
Keyword Arguments
  • val: double.

converts NaNs to the given number

Python prototype (for reference):

patchNaNs(a[, val]) -> a
Positional Arguments
  • a: UMat.
Keyword Arguments
  • val: double.

converts NaNs to the given number

Python prototype (for reference):

patchNaNs(a[, val]) -> a
Link to this function

pcaBackProject(data, mean, eigenvectors)

View Source
Positional Arguments
  • data: UMat
  • mean: UMat
  • eigenvectors: UMat
Keyword Arguments
  • result: UMat.

    wrap PCA::backProject

Python prototype (for reference):

PCABackProject(data, mean, eigenvectors[, result]) -> result
Link to this function

pcaBackProject(data, mean, eigenvectors, opts)

View Source
Positional Arguments
  • data: UMat
  • mean: UMat
  • eigenvectors: UMat
Keyword Arguments
  • result: UMat.

    wrap PCA::backProject

Python prototype (for reference):

PCABackProject(data, mean, eigenvectors[, result]) -> result
Positional Arguments
  • data: UMat
  • mean: UMat
Keyword Arguments
  • eigenvectors: UMat.

  • eigenvalues: UMat.

  • maxComponents: int.

    wrap PCA::operator() and add eigenvalues output parameter

Python prototype (for reference):

PCACompute2(data, mean[, eigenvectors[, eigenvalues[, maxComponents]]]) -> mean, eigenvectors, eigenvalues
Link to this function

pcaCompute2(data, mean, opts)

View Source

Variaint 1:

Positional Arguments
  • data: UMat
  • mean: UMat
  • retainedVariance: double
Keyword Arguments
  • eigenvectors: UMat.

  • eigenvalues: UMat.

    wrap PCA::operator() and add eigenvalues output parameter

Python prototype (for reference):

PCACompute2(data, mean, retainedVariance[, eigenvectors[, eigenvalues]]) -> mean, eigenvectors, eigenvalues

Variaint 2:

Positional Arguments
  • data: UMat
  • mean: UMat
Keyword Arguments
  • eigenvectors: UMat.

  • eigenvalues: UMat.

  • maxComponents: int.

    wrap PCA::operator() and add eigenvalues output parameter

Python prototype (for reference):

PCACompute2(data, mean[, eigenvectors[, eigenvalues[, maxComponents]]]) -> mean, eigenvectors, eigenvalues
Link to this function

pcaCompute2(data, mean, retainedVariance, opts)

View Source
Positional Arguments
  • data: UMat
  • mean: UMat
  • retainedVariance: double
Keyword Arguments
  • eigenvectors: UMat.

  • eigenvalues: UMat.

    wrap PCA::operator() and add eigenvalues output parameter

Python prototype (for reference):

PCACompute2(data, mean, retainedVariance[, eigenvectors[, eigenvalues]]) -> mean, eigenvectors, eigenvalues
Positional Arguments
  • data: UMat
  • mean: UMat
Keyword Arguments
  • eigenvectors: UMat.

  • maxComponents: int.

    wrap PCA::operator()

Python prototype (for reference):

PCACompute(data, mean[, eigenvectors[, maxComponents]]) -> mean, eigenvectors
Link to this function

pcaCompute(data, mean, opts)

View Source

Variaint 1:

Positional Arguments
  • data: UMat
  • mean: UMat
  • retainedVariance: double
Keyword Arguments
  • eigenvectors: UMat.

    wrap PCA::operator()

Python prototype (for reference):

PCACompute(data, mean, retainedVariance[, eigenvectors]) -> mean, eigenvectors

Variaint 2:

Positional Arguments
  • data: UMat
  • mean: UMat
Keyword Arguments
  • eigenvectors: UMat.

  • maxComponents: int.

    wrap PCA::operator()

Python prototype (for reference):

PCACompute(data, mean[, eigenvectors[, maxComponents]]) -> mean, eigenvectors
Link to this function

pcaCompute(data, mean, retainedVariance, opts)

View Source
Positional Arguments
  • data: UMat
  • mean: UMat
  • retainedVariance: double
Keyword Arguments
  • eigenvectors: UMat.

    wrap PCA::operator()

Python prototype (for reference):

PCACompute(data, mean, retainedVariance[, eigenvectors]) -> mean, eigenvectors
Link to this function

pcaProject(data, mean, eigenvectors)

View Source
Positional Arguments
  • data: UMat
  • mean: UMat
  • eigenvectors: UMat
Keyword Arguments
  • result: UMat.

    wrap PCA::project

Python prototype (for reference):

PCAProject(data, mean, eigenvectors[, result]) -> result
Link to this function

pcaProject(data, mean, eigenvectors, opts)

View Source
Positional Arguments
  • data: UMat
  • mean: UMat
  • eigenvectors: UMat
Keyword Arguments
  • result: UMat.

    wrap PCA::project

Python prototype (for reference):

PCAProject(data, mean, eigenvectors[, result]) -> result
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst1: UMat.
  • dst2: UMat.
  • sigma_s: float.
  • sigma_r: float.
  • shade_factor: float.

Pencil-like non-photorealistic line drawing

Python prototype (for reference):

pencilSketch(src[, dst1[, dst2[, sigma_s[, sigma_r[, shade_factor]]]]]) -> dst1, dst2
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst1: UMat.
  • dst2: UMat.
  • sigma_s: float.
  • sigma_r: float.
  • shade_factor: float.

Pencil-like non-photorealistic line drawing

Python prototype (for reference):

pencilSketch(src[, dst1[, dst2[, sigma_s[, sigma_r[, shade_factor]]]]]) -> dst1, dst2
Link to this function

perspectiveTransform(src, m)

View Source
Positional Arguments
  • src: UMat.
  • m: UMat.
Keyword Arguments
  • dst: UMat.

Performs the perspective matrix transformation of vectors. The function cv::perspectiveTransform transforms every element of src by treating it as a 2D or 3D vector, in the following way: \f[(x, y, z) \rightarrow (x'/w, y'/w, z'/w)\f] where \f[(x', y', z', w') = \texttt{mat} \cdot \begin{bmatrix} x & y & z & 1 \end{bmatrix}\f] and \f[w = \fork{w'}{if (w' \ne 0)}{\infty}{otherwise}\f] Here a 3D vector transformation is shown. In case of a 2D vector transformation, the z component is omitted. Note: The function transforms a sparse set of 2D or 3D vectors. If you want to transform an image using perspective transformation, use warpPerspective . If you have an inverse problem, that is, you want to compute the most probable perspective transformation out of several pairs of corresponding points, you can use getPerspectiveTransform or findHomography .

element is a 2D/3D vector to be transformed.

@sa transform, warpPerspective, getPerspectiveTransform, findHomography

Python prototype (for reference):

perspectiveTransform(src, m[, dst]) -> dst
Link to this function

perspectiveTransform(src, m, opts)

View Source
Positional Arguments
  • src: UMat.
  • m: UMat.
Keyword Arguments
  • dst: UMat.

Performs the perspective matrix transformation of vectors. The function cv::perspectiveTransform transforms every element of src by treating it as a 2D or 3D vector, in the following way: \f[(x, y, z) \rightarrow (x'/w, y'/w, z'/w)\f] where \f[(x', y', z', w') = \texttt{mat} \cdot \begin{bmatrix} x & y & z & 1 \end{bmatrix}\f] and \f[w = \fork{w'}{if (w' \ne 0)}{\infty}{otherwise}\f] Here a 3D vector transformation is shown. In case of a 2D vector transformation, the z component is omitted. Note: The function transforms a sparse set of 2D or 3D vectors. If you want to transform an image using perspective transformation, use warpPerspective . If you have an inverse problem, that is, you want to compute the most probable perspective transformation out of several pairs of corresponding points, you can use getPerspectiveTransform or findHomography .

element is a 2D/3D vector to be transformed.

@sa transform, warpPerspective, getPerspectiveTransform, findHomography

Python prototype (for reference):

perspectiveTransform(src, m[, dst]) -> dst
Positional Arguments
  • x: UMat.
  • y: UMat.
Keyword Arguments
  • angle: UMat.
  • angleInDegrees: bool.

Calculates the rotation angle of 2D vectors. The function cv::phase calculates the rotation angle of each 2D vector that is formed from the corresponding elements of x and y : \f[\texttt{angle} (I) = \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))\f] The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0 , the corresponding angle(I) is set to 0.

same size and the same type as x.
same type as x .
degrees, otherwise, they are measured in radians.

Python prototype (for reference):

phase(x, y[, angle[, angleInDegrees]]) -> angle
Positional Arguments
  • x: UMat.
  • y: UMat.
Keyword Arguments
  • angle: UMat.
  • angleInDegrees: bool.

Calculates the rotation angle of 2D vectors. The function cv::phase calculates the rotation angle of each 2D vector that is formed from the corresponding elements of x and y : \f[\texttt{angle} (I) = \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))\f] The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0 , the corresponding angle(I) is set to 0.

same size and the same type as x.
same type as x .
degrees, otherwise, they are measured in radians.

Python prototype (for reference):

phase(x, y[, angle[, angleInDegrees]]) -> angle
Link to this function

phaseCorrelate(src1, src2)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • window: UMat.

The function is used to detect translational shifts that occur between two images. The operation takes advantage of the Fourier shift theorem for detecting the translational shift in the frequency domain. It can be used for fast image registration as well as motion estimation. For more information please see http://en.wikipedia.org/wiki/Phase_correlation Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed with getOptimalDFTSize. The function performs the following equations:

  • First it applies a Hanning window (see http://en.wikipedia.org/wiki/Hann_function) to each image to remove possible edge effects. This window is cached until the array size changes to speed up processing time.
  • Next it computes the forward DFTs of each source array: \f[\mathbf{G}_a = \mathcal{F}\{src_1\}, \; \mathbf{G}_b = \mathcal{F}\{src_2\}\f] where \f$\mathcal{F}\f$ is the forward DFT.
  • It then computes the cross-power spectrum of each frequency domain array: \f[R = \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^*|}\f]
  • Next the cross-correlation is converted back into the time domain via the inverse DFT: \f[r = \mathcal{F}^{-1}\{R\}\f]
  • Finally, it computes the peak location and computes a 5x5 weighted centroid around the peak to achieve sub-pixel accuracy. \f[(\Delta x, \Delta y) = \texttt{weightedCentroid} \{\arg \max_{(x, y)}\{r\}\}\f]
  • If non-zero, the response parameter is computed as the sum of the elements of r within the 5x5 centroid around the peak location. It is normalized to a maximum of 1 (meaning there is a single peak) and will be smaller when there are multiple peaks. @returns detected phase shift (sub-pixel) between the two arrays. @sa dft, getOptimalDFTSize, idft, mulSpectrums createHanningWindow

Python prototype (for reference):

phaseCorrelate(src1, src2[, window]) -> retval, response
Link to this function

phaseCorrelate(src1, src2, opts)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • window: UMat.

The function is used to detect translational shifts that occur between two images. The operation takes advantage of the Fourier shift theorem for detecting the translational shift in the frequency domain. It can be used for fast image registration as well as motion estimation. For more information please see http://en.wikipedia.org/wiki/Phase_correlation Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed with getOptimalDFTSize. The function performs the following equations:

  • First it applies a Hanning window (see http://en.wikipedia.org/wiki/Hann_function) to each image to remove possible edge effects. This window is cached until the array size changes to speed up processing time.
  • Next it computes the forward DFTs of each source array: \f[\mathbf{G}_a = \mathcal{F}\{src_1\}, \; \mathbf{G}_b = \mathcal{F}\{src_2\}\f] where \f$\mathcal{F}\f$ is the forward DFT.
  • It then computes the cross-power spectrum of each frequency domain array: \f[R = \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^*|}\f]
  • Next the cross-correlation is converted back into the time domain via the inverse DFT: \f[r = \mathcal{F}^{-1}\{R\}\f]
  • Finally, it computes the peak location and computes a 5x5 weighted centroid around the peak to achieve sub-pixel accuracy. \f[(\Delta x, \Delta y) = \texttt{weightedCentroid} \{\arg \max_{(x, y)}\{r\}\}\f]
  • If non-zero, the response parameter is computed as the sum of the elements of r within the 5x5 centroid around the peak location. It is normalized to a maximum of 1 (meaning there is a single peak) and will be smaller when there are multiple peaks. @returns detected phase shift (sub-pixel) between the two arrays. @sa dft, getOptimalDFTSize, idft, mulSpectrums createHanningWindow

Python prototype (for reference):

phaseCorrelate(src1, src2[, window]) -> retval, response
Link to this function

pointPolygonTest(contour, pt, measureDist)

View Source

Performs a point-in-contour test. The function determines whether the point is inside a contour, outside, or lies on an edge (or coincides with a vertex). It returns positive (inside), negative (outside), or zero (on an edge) value, correspondingly. When measureDist=false , the return value is +1, -1, and 0, respectively. Otherwise, the return value is a signed distance between the point and the nearest contour edge. See below a sample output of the function where each image pixel is tested against the contour: sample output

nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not.

Python prototype (for reference):

pointPolygonTest(contour, pt, measureDist) -> retval
Link to this function

polarToCart(magnitude, angle)

View Source
Positional Arguments
  • magnitude: UMat.
  • angle: UMat.
Keyword Arguments
  • x: UMat.
  • y: UMat.
  • angleInDegrees: bool.

Calculates x and y coordinates of 2D vectors from their magnitude and angle. The function cv::polarToCart calculates the Cartesian coordinates of each 2D vector represented by the corresponding elements of magnitude and angle: \f[\begin{array}{l} \texttt{x} (I) = \texttt{magnitude} (I) \cos ( \texttt{angle} (I)) \\ \texttt{y} (I) = \texttt{magnitude} (I) \sin ( \texttt{angle} (I)) \\ \end{array}\f] The relative accuracy of the estimated coordinates is about 1e-6.

it can be an empty matrix (=Mat()), in this case, the function assumes
that all the magnitudes are =1; if it is not empty, it must have the
same size and type as angle.
size and type as angle.
size and type as angle.
degrees, otherwise, they are measured in radians.

@sa cartToPolar, magnitude, phase, exp, log, pow, sqrt

Python prototype (for reference):

polarToCart(magnitude, angle[, x[, y[, angleInDegrees]]]) -> x, y
Link to this function

polarToCart(magnitude, angle, opts)

View Source
Positional Arguments
  • magnitude: UMat.
  • angle: UMat.
Keyword Arguments
  • x: UMat.
  • y: UMat.
  • angleInDegrees: bool.

Calculates x and y coordinates of 2D vectors from their magnitude and angle. The function cv::polarToCart calculates the Cartesian coordinates of each 2D vector represented by the corresponding elements of magnitude and angle: \f[\begin{array}{l} \texttt{x} (I) = \texttt{magnitude} (I) \cos ( \texttt{angle} (I)) \\ \texttt{y} (I) = \texttt{magnitude} (I) \sin ( \texttt{angle} (I)) \\ \end{array}\f] The relative accuracy of the estimated coordinates is about 1e-6.

it can be an empty matrix (=Mat()), in this case, the function assumes
that all the magnitudes are =1; if it is not empty, it must have the
same size and type as angle.
size and type as angle.
size and type as angle.
degrees, otherwise, they are measured in radians.

@sa cartToPolar, magnitude, phase, exp, log, pow, sqrt

Python prototype (for reference):

polarToCart(magnitude, angle[, x[, y[, angleInDegrees]]]) -> x, y

Polls for a pressed key. The function pollKey polls for a key event without waiting. It returns the code of the pressed key or -1 if no key was pressed since the last invocation. To wait until a key was pressed, use #waitKey. Note: The functions #waitKey and #pollKey are the only methods in HighGUI that can fetch and handle GUI events, so one of them needs to be called periodically for normal event processing unless HighGUI is used within an environment that takes care of event processing. Note: The function only works if there is at least one HighGUI window created and the window is active. If there are several HighGUI windows, any of them can be active.

Python prototype (for reference):

pollKey() -> retval
Link to this function

polylines(img, pts, isClosed, color)

View Source
Positional Arguments
  • img: UMat. Image.
  • pts: vector_UMat.
  • isClosed: bool.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws several polygonal curves.

the function draws a line from the last vertex of each curve to its first vertex.

The function cv::polylines draws one or more polygonal curves.

Python prototype (for reference):

polylines(img, pts, isClosed, color[, thickness[, lineType[, shift]]]) -> img
Link to this function

polylines(img, pts, isClosed, color, opts)

View Source
Positional Arguments
  • img: UMat. Image.
  • pts: vector_UMat.
  • isClosed: bool.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws several polygonal curves.

the function draws a line from the last vertex of each curve to its first vertex.

The function cv::polylines draws one or more polygonal curves.

Python prototype (for reference):

polylines(img, pts, isClosed, color[, thickness[, lineType[, shift]]]) -> img
Positional Arguments
  • src: UMat.
  • power: double.
Keyword Arguments
  • dst: UMat.

Raises every array element to a power. The function cv::pow raises every element of the input array to power : \f[\texttt{dst} (I) = \fork{\texttt{src}(I)^{power}}{if (\texttt{power}) is integer}{|\texttt{src}(I)|^{power}}{otherwise}\f] So, for a non-integer power exponent, the absolute values of input array elements are used. However, it is possible to get true values for negative values using some extra operations. In the example below, computing the 5th root of array src shows:

Mat mask = src < 0;
pow(src, 1./5, dst);
subtract(Scalar::all(0), dst, dst, mask);

For some values of power, such as integer values, 0.5 and -0.5, specialized faster algorithms are used. Special values (NaN, Inf) are not handled. @sa sqrt, exp, log, cartToPolar, polarToCart

Python prototype (for reference):

pow(src, power[, dst]) -> dst
Positional Arguments
  • src: UMat.
  • power: double.
Keyword Arguments
  • dst: UMat.

Raises every array element to a power. The function cv::pow raises every element of the input array to power : \f[\texttt{dst} (I) = \fork{\texttt{src}(I)^{power}}{if (\texttt{power}) is integer}{|\texttt{src}(I)|^{power}}{otherwise}\f] So, for a non-integer power exponent, the absolute values of input array elements are used. However, it is possible to get true values for negative values using some extra operations. In the example below, computing the 5th root of array src shows:

Mat mask = src < 0;
pow(src, 1./5, dst);
subtract(Scalar::all(0), dst, dst, mask);

For some values of power, such as integer values, 0.5 and -0.5, specialized faster algorithms are used. Special values (NaN, Inf) are not handled. @sa sqrt, exp, log, cartToPolar, polarToCart

Python prototype (for reference):

pow(src, power[, dst]) -> dst
Link to this function

preCornerDetect(src, ksize)

View Source
Positional Arguments
  • src: UMat.
  • ksize: int.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Calculates a feature map for corner detection. The function calculates the complex spatial derivative-based function of the source image \f[\texttt{dst} = (D_x \texttt{src} )^2 \cdot D_{yy} \texttt{src} + (D_y \texttt{src} )^2 \cdot D_{xx} \texttt{src} - 2 D_x \texttt{src} \cdot D_y \texttt{src} \cdot D_{xy} \texttt{src}\f] where \f$D_x\f$,\f$D_y\f$ are the first image derivatives, \f$D_{xx}\f$,\f$D_{yy}\f$ are the second image derivatives, and \f$D_{xy}\f$ is the mixed derivative. The corners can be found as local maximums of the functions, as shown below:

Mat corners, dilated_corners;
preCornerDetect(image, corners, 3);
// dilation with 3x3 rectangular structuring element
dilate(corners, dilated_corners, Mat(), 1);
Mat corner_mask = corners == dilated_corners;

Python prototype (for reference):

preCornerDetect(src, ksize[, dst[, borderType]]) -> dst
Link to this function

preCornerDetect(src, ksize, opts)

View Source
Positional Arguments
  • src: UMat.
  • ksize: int.
Keyword Arguments
  • dst: UMat.
  • borderType: int.

Calculates a feature map for corner detection. The function calculates the complex spatial derivative-based function of the source image \f[\texttt{dst} = (D_x \texttt{src} )^2 \cdot D_{yy} \texttt{src} + (D_y \texttt{src} )^2 \cdot D_{xx} \texttt{src} - 2 D_x \texttt{src} \cdot D_y \texttt{src} \cdot D_{xy} \texttt{src}\f] where \f$D_x\f$,\f$D_y\f$ are the first image derivatives, \f$D_{xx}\f$,\f$D_{yy}\f$ are the second image derivatives, and \f$D_{xy}\f$ is the mixed derivative. The corners can be found as local maximums of the functions, as shown below:

Mat corners, dilated_corners;
preCornerDetect(image, corners, 3);
// dilation with 3x3 rectangular structuring element
dilate(corners, dilated_corners, Mat(), 1);
Mat corner_mask = corners == dilated_corners;

Python prototype (for reference):

preCornerDetect(src, ksize[, dst[, borderType]]) -> dst
Link to this function

projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs)

View Source
Positional Arguments
  • objectPoints: UMat.
  • rvec: UMat.
  • tvec: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • imagePoints: UMat.
  • jacobian: UMat.
  • aspectRatio: double.

Projects 3D points to an image plane.

1-channel or 1xN/Nx1 3-channel (or vector\<Point3f\> ), where N is the number of points in the view.
basis from world to camera coordinate system, see @ref calibrateCamera for details.
\f$\distcoeffs\f$ . If the vector is empty, the zero distortion coefficients are assumed.
vector\<Point2f\> .
points with respect to components of the rotation vector, translation vector, focal lengths,
coordinates of the principal point and the distortion coefficients. In the old interface different
components of the jacobian are returned via different output parameters.
function assumes that the aspect ratio (\f$f\_x / f\_y\f$) is fixed and correspondingly adjusts the
jacobian matrix.

The function computes the 2D projections of 3D points to the image plane, given intrinsic and extrinsic camera parameters. Optionally, the function computes Jacobians -matrices of partial derivatives of image points coordinates (as functions of all the input parameters) with respect to the particular parameters, intrinsic and/or extrinsic. The Jacobians are used during the global optimization in @ref calibrateCamera, @ref solvePnP, and @ref stereoCalibrate. The function itself can also be used to compute a re-projection error, given the current intrinsic and extrinsic parameters. Note: By setting rvec = tvec = \f$[0, 0, 0]\f$, or by setting cameraMatrix to a 3x3 identity matrix, or by passing zero distortion coefficients, one can get various useful partial cases of the function. This means, one can compute the distorted coordinates for a sparse set of points or apply a perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup.

Python prototype (for reference):

projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs[, imagePoints[, jacobian[, aspectRatio]]]) -> imagePoints, jacobian
Link to this function

projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs, opts)

View Source
Positional Arguments
  • objectPoints: UMat.
  • rvec: UMat.
  • tvec: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • imagePoints: UMat.
  • jacobian: UMat.
  • aspectRatio: double.

Projects 3D points to an image plane.

1-channel or 1xN/Nx1 3-channel (or vector\<Point3f\> ), where N is the number of points in the view.
basis from world to camera coordinate system, see @ref calibrateCamera for details.
\f$\distcoeffs\f$ . If the vector is empty, the zero distortion coefficients are assumed.
vector\<Point2f\> .
points with respect to components of the rotation vector, translation vector, focal lengths,
coordinates of the principal point and the distortion coefficients. In the old interface different
components of the jacobian are returned via different output parameters.
function assumes that the aspect ratio (\f$f\_x / f\_y\f$) is fixed and correspondingly adjusts the
jacobian matrix.

The function computes the 2D projections of 3D points to the image plane, given intrinsic and extrinsic camera parameters. Optionally, the function computes Jacobians -matrices of partial derivatives of image points coordinates (as functions of all the input parameters) with respect to the particular parameters, intrinsic and/or extrinsic. The Jacobians are used during the global optimization in @ref calibrateCamera, @ref solvePnP, and @ref stereoCalibrate. The function itself can also be used to compute a re-projection error, given the current intrinsic and extrinsic parameters. Note: By setting rvec = tvec = \f$[0, 0, 0]\f$, or by setting cameraMatrix to a 3x3 identity matrix, or by passing zero distortion coefficients, one can get various useful partial cases of the function. This means, one can compute the distorted coordinates for a sparse set of points or apply a perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup.

Python prototype (for reference):

projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs[, imagePoints[, jacobian[, aspectRatio]]]) -> imagePoints, jacobian
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • r: double.

Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric. This function calculates the Peak Signal-to-Noise Ratio (PSNR) image quality metric in decibels (dB), between two input arrays src1 and src2. The arrays must have the same type. The PSNR is calculated as follows: \f[ \texttt{PSNR} = 10 \cdot \log_{10}{\left( \frac{R^2}{MSE} \right) } \f] where R is the maximum integer value of depth (e.g. 255 in the case of CV_8U data) and MSE is the mean squared error between the two arrays.

Python prototype (for reference):

PSNR(src1, src2[, R]) -> retval
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • r: double.

Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric. This function calculates the Peak Signal-to-Noise Ratio (PSNR) image quality metric in decibels (dB), between two input arrays src1 and src2. The arrays must have the same type. The PSNR is calculated as follows: \f[ \texttt{PSNR} = 10 \cdot \log_{10}{\left( \frac{R^2}{MSE} \right) } \f] where R is the maximum integer value of depth (e.g. 255 in the case of CV_8U data) and MSE is the mean squared error between the two arrays.

Python prototype (for reference):

PSNR(src1, src2[, R]) -> retval
Link to this function

putText(img, text, org, fontFace, fontScale, color)

View Source
Positional Arguments
  • img: UMat. Image.
  • text: String.
  • org: Point.
  • fontFace: int.
  • fontScale: double.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • bottomLeftOrigin: bool.

Draws a text string. The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by question marks. See #getTextSize for a text rendering code example.

it is at the top-left corner.

Python prototype (for reference):

putText(img, text, org, fontFace, fontScale, color[, thickness[, lineType[, bottomLeftOrigin]]]) -> img
Link to this function

putText(img, text, org, fontFace, fontScale, color, opts)

View Source
Positional Arguments
  • img: UMat. Image.
  • text: String.
  • org: Point.
  • fontFace: int.
  • fontScale: double.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • bottomLeftOrigin: bool.

Draws a text string. The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by question marks. See #getTextSize for a text rendering code example.

it is at the top-left corner.

Python prototype (for reference):

putText(img, text, org, fontFace, fontScale, color[, thickness[, lineType[, bottomLeftOrigin]]]) -> img
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • dstsize: Size.
  • borderType: int.

Blurs an image and downsamples it. By default, size of the output image is computed as Size((src.cols+1)/2, (src.rows+1)/2), but in any case, the following conditions should be satisfied: \f[\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\f] The function performs the downsampling step of the Gaussian pyramid construction. First, it convolves the source image with the kernel: \f[\frac{1}{256} \begin{bmatrix} 1 & 4 & 6 & 4 & 1 \\ 4 & 16 & 24 & 16 & 4 \\ 6 & 24 & 36 & 24 & 6 \\ 4 & 16 & 24 & 16 & 4 \\ 1 & 4 & 6 & 4 & 1 \end{bmatrix}\f] Then, it downsamples the image by rejecting even rows and columns.

Python prototype (for reference):

pyrDown(src[, dst[, dstsize[, borderType]]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • dstsize: Size.
  • borderType: int.

Blurs an image and downsamples it. By default, size of the output image is computed as Size((src.cols+1)/2, (src.rows+1)/2), but in any case, the following conditions should be satisfied: \f[\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\f] The function performs the downsampling step of the Gaussian pyramid construction. First, it convolves the source image with the kernel: \f[\frac{1}{256} \begin{bmatrix} 1 & 4 & 6 & 4 & 1 \\ 4 & 16 & 24 & 16 & 4 \\ 6 & 24 & 36 & 24 & 6 \\ 4 & 16 & 24 & 16 & 4 \\ 1 & 4 & 6 & 4 & 1 \end{bmatrix}\f] Then, it downsamples the image by rejecting even rows and columns.

Python prototype (for reference):

pyrDown(src[, dst[, dstsize[, borderType]]]) -> dst
Link to this function

pyrMeanShiftFiltering(src, sp, sr)

View Source
Positional Arguments
  • src: UMat.
  • sp: double.
  • sr: double.
Keyword Arguments
  • dst: UMat.
  • maxLevel: int.
  • termcrit: TermCriteria.

Performs initial step of meanshift segmentation of an image. The function implements the filtering stage of meanshift segmentation, that is, the output of the function is the filtered "posterized" image with color gradients and fine-grain texture flattened. At every pixel (X,Y) of the input image (or down-sized input image, see below) the function executes meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is considered: \f[(x,y): X- \texttt{sp} \le x \le X+ \texttt{sp} , Y- \texttt{sp} \le y \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)|| \le \texttt{sr}\f] where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively (though, the algorithm does not depend on the color space used, so any 3-component color space can be used instead). Over the neighborhood the average spatial value (X',Y') and average color vector (R',G',B') are found and they act as the neighborhood center on the next iteration: \f[(X,Y)~(X',Y'), (R,G,B)~(R',G',B').\f] After the iterations over, the color components of the initial pixel (that is, the pixel from where the iterations started) are set to the final value (average color at the last iteration): \f[I(X,Y) <- (R*,G*,B*)\f] When maxLevel > 0, the gaussian pyramid of maxLevel+1 levels is built, and the above procedure is run on the smallest layer first. After that, the results are propagated to the larger layer and the iterations are run again only on those pixels where the layer colors differ by more than sr from the lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the results will be actually different from the ones obtained by running the meanshift procedure on the whole original image (i.e. when maxLevel==0).

Python prototype (for reference):

pyrMeanShiftFiltering(src, sp, sr[, dst[, maxLevel[, termcrit]]]) -> dst
Link to this function

pyrMeanShiftFiltering(src, sp, sr, opts)

View Source
Positional Arguments
  • src: UMat.
  • sp: double.
  • sr: double.
Keyword Arguments
  • dst: UMat.
  • maxLevel: int.
  • termcrit: TermCriteria.

Performs initial step of meanshift segmentation of an image. The function implements the filtering stage of meanshift segmentation, that is, the output of the function is the filtered "posterized" image with color gradients and fine-grain texture flattened. At every pixel (X,Y) of the input image (or down-sized input image, see below) the function executes meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is considered: \f[(x,y): X- \texttt{sp} \le x \le X+ \texttt{sp} , Y- \texttt{sp} \le y \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)|| \le \texttt{sr}\f] where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively (though, the algorithm does not depend on the color space used, so any 3-component color space can be used instead). Over the neighborhood the average spatial value (X',Y') and average color vector (R',G',B') are found and they act as the neighborhood center on the next iteration: \f[(X,Y)~(X',Y'), (R,G,B)~(R',G',B').\f] After the iterations over, the color components of the initial pixel (that is, the pixel from where the iterations started) are set to the final value (average color at the last iteration): \f[I(X,Y) <- (R*,G*,B*)\f] When maxLevel > 0, the gaussian pyramid of maxLevel+1 levels is built, and the above procedure is run on the smallest layer first. After that, the results are propagated to the larger layer and the iterations are run again only on those pixels where the layer colors differ by more than sr from the lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the results will be actually different from the ones obtained by running the meanshift procedure on the whole original image (i.e. when maxLevel==0).

Python prototype (for reference):

pyrMeanShiftFiltering(src, sp, sr[, dst[, maxLevel[, termcrit]]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • dstsize: Size.
  • borderType: int.

Upsamples an image and then blurs it. By default, size of the output image is computed as Size(src.cols\*2, (src.rows\*2), but in any case, the following conditions should be satisfied: \f[\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\f] The function performs the upsampling step of the Gaussian pyramid construction, though it can actually be used to construct the Laplacian pyramid. First, it upsamples the source image by injecting even zero rows and columns and then convolves the result with the same kernel as in pyrDown multiplied by 4.

Python prototype (for reference):

pyrUp(src[, dst[, dstsize[, borderType]]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • dstsize: Size.
  • borderType: int.

Upsamples an image and then blurs it. By default, size of the output image is computed as Size(src.cols\*2, (src.rows\*2), but in any case, the following conditions should be satisfied: \f[\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\f] The function performs the upsampling step of the Gaussian pyramid construction, though it can actually be used to construct the Laplacian pyramid. First, it upsamples the source image by injecting even zero rows and columns and then convolves the result with the same kernel as in pyrDown multiplied by 4.

Python prototype (for reference):

pyrUp(src[, dst[, dstsize[, borderType]]]) -> dst
Link to this function

randn(dst, mean, stddev)

View Source

Fills the array with normally distributed random numbers. The function cv::randn fills the matrix dst with normally distributed random numbers with the specified mean vector and the standard deviation matrix. The generated random numbers are clipped to fit the value range of the output array data type.

which case a diagonal standard deviation matrix is assumed) or a square matrix.

@sa RNG, randu

Python prototype (for reference):

randn(dst, mean, stddev) -> dst
Positional Arguments
  • dst: UMat.
Keyword Arguments
  • iterFactor: double.

Shuffles the array elements randomly. The function cv::randShuffle shuffles the specified 1D array by randomly choosing pairs of elements and swapping them. The number of such swap operations will be dst.rows*dst.cols*iterFactor .

below).
instead.

@sa RNG, sort

Python prototype (for reference):

randShuffle(dst[, iterFactor]) -> dst
Positional Arguments
  • dst: UMat.
Keyword Arguments
  • iterFactor: double.

Shuffles the array elements randomly. The function cv::randShuffle shuffles the specified 1D array by randomly choosing pairs of elements and swapping them. The number of such swap operations will be dst.rows*dst.cols*iterFactor .

below).
instead.

@sa RNG, sort

Python prototype (for reference):

randShuffle(dst[, iterFactor]) -> dst

Generates a single uniformly-distributed random number or an array of random numbers. Non-template variant of the function fills the matrix dst with uniformly-distributed random numbers from the specified range: \f[\texttt{low} _c \leq \texttt{dst} (I)_c < \texttt{high} _c\f] @sa RNG, randn, theRNG

Python prototype (for reference):

randu(dst, low, high) -> dst

Read a .flo file The function readOpticalFlow loads a flow field from a file and returns it as a single matrix. Resulting Mat has a type CV_32FC2 - floating-point, 2-channel. First channel corresponds to the flow in the horizontal direction (u), second - vertical (v).

Python prototype (for reference):

readOpticalFlow(path) -> retval
Link to this function

recoverPose(e, points1, points2)

View Source
Positional Arguments
  • e: UMat.
  • points1: UMat.
  • points2: UMat.
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • focal: double.
  • pp: Point2d.
  • mask: UMat.

Has overloading in C++

floating-point (single or double precision).
that performs a change of basis from the first camera's coordinate system to the second camera's
coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
description below.
therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
length.
are feature points from cameras with same focal length and principal point.
inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
recover pose. In the output mask only inliers which pass the cheirality check.

This function differs from the one above that it computes camera intrinsic matrix from focal length and principal point: \f[A = \begin{bmatrix} f & 0 & x_{pp} \\ 0 & f & y_{pp} \\ 0 & 0 & 1 \end{bmatrix}\f]

Python prototype (for reference):

recoverPose(E, points1, points2[, R[, t[, focal[, pp[, mask]]]]]) -> retval, R, t, mask
Link to this function

recoverPose(e, points1, points2, opts)

View Source

Variaint 1:

Positional Arguments
  • e: UMat.
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix: UMat.
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • mask: UMat.

Recovers the relative camera rotation and the translation from an estimated essential matrix and the corresponding points in two images, using cheirality check. Returns the number of inliers that pass the check.

floating-point (single or double precision).
Note that this function assumes that points1 and points2 are feature points from cameras with the
same camera intrinsic matrix.
that performs a change of basis from the first camera's coordinate system to the second camera's
coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
described below.
therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
length.
inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
recover pose. In the output mask only inliers which pass the cheirality check.

This function decomposes an essential matrix using @ref decomposeEssentialMat and then verifies possible pose hypotheses by doing cheirality check. The cheirality check means that the triangulated 3D points should have positive depth. Some details can be found in @cite Nister03. This function can be used to process the output E and mask from @ref findEssentialMat. In this scenario, points1 and points2 are the same input for #findEssentialMat :

// Example. Estimation of fundamental matrix using the RANSAC algorithm
int point_count = 100;
vector<Point2f> points1(point_count);
vector<Point2f> points2(point_count);
// initialize the points here ...
for( int i = 0; i < point_count; i++ )
{
points1[i] = ...;
points2[i] = ...;
}
// cametra matrix with both focal lengths = 1, and principal point = (0, 0)
Mat cameraMatrix = Mat::eye(3, 3, CV_64F);
Mat E, R, t, mask;
E = findEssentialMat(points1, points2, cameraMatrix, RANSAC, 0.999, 1.0, mask);
recoverPose(E, points1, points2, cameraMatrix, R, t, mask);

Python prototype (for reference):

recoverPose(E, points1, points2, cameraMatrix[, R[, t[, mask]]]) -> retval, R, t, mask

Variaint 2:

Positional Arguments
  • e: UMat.
  • points1: UMat.
  • points2: UMat.
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • focal: double.
  • pp: Point2d.
  • mask: UMat.

Has overloading in C++

floating-point (single or double precision).
that performs a change of basis from the first camera's coordinate system to the second camera's
coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
description below.
therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
length.
are feature points from cameras with same focal length and principal point.
inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
recover pose. In the output mask only inliers which pass the cheirality check.

This function differs from the one above that it computes camera intrinsic matrix from focal length and principal point: \f[A = \begin{bmatrix} f & 0 & x_{pp} \\ 0 & f & y_{pp} \\ 0 & 0 & 1 \end{bmatrix}\f]

Python prototype (for reference):

recoverPose(E, points1, points2[, R[, t[, focal[, pp[, mask]]]]]) -> retval, R, t, mask
Link to this function

recoverPose(e, points1, points2, cameraMatrix, opts)

View Source

Variaint 1:

Positional Arguments
  • e: UMat.
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix: UMat.
  • distanceThresh: double.
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • mask: UMat.
  • triangulatedPoints: UMat.

Has overloading in C++

floating-point (single or double precision).
Note that this function assumes that points1 and points2 are feature points from cameras with the
same camera intrinsic matrix.
that performs a change of basis from the first camera's coordinate system to the second camera's
coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
description below.
therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
length.
points).
inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
recover pose. In the output mask only inliers which pass the cheirality check.

This function differs from the one above that it outputs the triangulated 3D point that are used for the cheirality check.

Python prototype (for reference):

recoverPose(E, points1, points2, cameraMatrix, distanceThresh[, R[, t[, mask[, triangulatedPoints]]]]) -> retval, R, t, mask, triangulatedPoints

Variaint 2:

Positional Arguments
  • e: UMat.
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix: UMat.
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • mask: UMat.

Recovers the relative camera rotation and the translation from an estimated essential matrix and the corresponding points in two images, using cheirality check. Returns the number of inliers that pass the check.

floating-point (single or double precision).
Note that this function assumes that points1 and points2 are feature points from cameras with the
same camera intrinsic matrix.
that performs a change of basis from the first camera's coordinate system to the second camera's
coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
described below.
therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
length.
inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
recover pose. In the output mask only inliers which pass the cheirality check.

This function decomposes an essential matrix using @ref decomposeEssentialMat and then verifies possible pose hypotheses by doing cheirality check. The cheirality check means that the triangulated 3D points should have positive depth. Some details can be found in @cite Nister03. This function can be used to process the output E and mask from @ref findEssentialMat. In this scenario, points1 and points2 are the same input for #findEssentialMat :

// Example. Estimation of fundamental matrix using the RANSAC algorithm
int point_count = 100;
vector<Point2f> points1(point_count);
vector<Point2f> points2(point_count);
// initialize the points here ...
for( int i = 0; i < point_count; i++ )
{
points1[i] = ...;
points2[i] = ...;
}
// cametra matrix with both focal lengths = 1, and principal point = (0, 0)
Mat cameraMatrix = Mat::eye(3, 3, CV_64F);
Mat E, R, t, mask;
E = findEssentialMat(points1, points2, cameraMatrix, RANSAC, 0.999, 1.0, mask);
recoverPose(E, points1, points2, cameraMatrix, R, t, mask);

Python prototype (for reference):

recoverPose(E, points1, points2, cameraMatrix[, R[, t[, mask]]]) -> retval, R, t, mask
Link to this function

recoverPose(e, points1, points2, cameraMatrix, distanceThresh, opts)

View Source

Variaint 1:

Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
Keyword Arguments
  • e: UMat.
  • r: UMat.
  • t: UMat.
  • method: int.
  • prob: double.
  • threshold: double.
  • mask: UMat.

Recovers the relative camera rotation and the translation from corresponding points in two images from two different cameras, using cheirality check. Returns the number of inliers that pass the check.

floating-point (single or double precision).

@ref calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below. @ref calibrateCamera. @ref calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below. @ref calibrateCamera.

that performs a change of basis from the first camera's coordinate system to the second camera's
coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
described below.
therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
length.
-   @ref RANSAC for the RANSAC algorithm.
-   @ref LMEDS for the LMedS algorithm.
confidence (probability) that the estimated matrix is correct.
line in pixels, beyond which the point is considered an outlier and is not used for computing the
final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
point localization, image resolution, and the image noise.
inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
recover pose. In the output mask only inliers which pass the cheirality check.

This function decomposes an essential matrix using @ref decomposeEssentialMat and then verifies possible pose hypotheses by doing cheirality check. The cheirality check means that the triangulated 3D points should have positive depth. Some details can be found in @cite Nister03. This function can be used to process the output E and mask from @ref findEssentialMat. In this scenario, points1 and points2 are the same input for findEssentialMat.:

// Example. Estimation of fundamental matrix using the RANSAC algorithm
int point_count = 100;
vector<Point2f> points1(point_count);
vector<Point2f> points2(point_count);
// initialize the points here ...
for( int i = 0; i < point_count; i++ )
{
points1[i] = ...;
points2[i] = ...;
}
// Input: camera calibration of both cameras, for example using intrinsic chessboard calibration.
Mat cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2;
// Output: Essential matrix, relative rotation and relative translation.
Mat E, R, t, mask;
recoverPose(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, E, R, t, mask);

Python prototype (for reference):

recoverPose(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2[, E[, R[, t[, method[, prob[, threshold[, mask]]]]]]]) -> retval, E, R, t, mask

Variaint 2:

Positional Arguments
  • e: UMat.
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix: UMat.
  • distanceThresh: double.
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • mask: UMat.
  • triangulatedPoints: UMat.

Has overloading in C++

floating-point (single or double precision).
Note that this function assumes that points1 and points2 are feature points from cameras with the
same camera intrinsic matrix.
that performs a change of basis from the first camera's coordinate system to the second camera's
coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
description below.
therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
length.
points).
inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
recover pose. In the output mask only inliers which pass the cheirality check.

This function differs from the one above that it outputs the triangulated 3D point that are used for the cheirality check.

Python prototype (for reference):

recoverPose(E, points1, points2, cameraMatrix, distanceThresh[, R[, t[, mask[, triangulatedPoints]]]]) -> retval, R, t, mask, triangulatedPoints
Link to this function

recoverPose(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, opts)

View Source
Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
Keyword Arguments
  • e: UMat.
  • r: UMat.
  • t: UMat.
  • method: int.
  • prob: double.
  • threshold: double.
  • mask: UMat.

Recovers the relative camera rotation and the translation from corresponding points in two images from two different cameras, using cheirality check. Returns the number of inliers that pass the check.

floating-point (single or double precision).

@ref calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below. @ref calibrateCamera. @ref calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below. @ref calibrateCamera.

that performs a change of basis from the first camera's coordinate system to the second camera's
coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
described below.
therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
length.
-   @ref RANSAC for the RANSAC algorithm.
-   @ref LMEDS for the LMedS algorithm.
confidence (probability) that the estimated matrix is correct.
line in pixels, beyond which the point is considered an outlier and is not used for computing the
final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
point localization, image resolution, and the image noise.
inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
recover pose. In the output mask only inliers which pass the cheirality check.

This function decomposes an essential matrix using @ref decomposeEssentialMat and then verifies possible pose hypotheses by doing cheirality check. The cheirality check means that the triangulated 3D points should have positive depth. Some details can be found in @cite Nister03. This function can be used to process the output E and mask from @ref findEssentialMat. In this scenario, points1 and points2 are the same input for findEssentialMat.:

// Example. Estimation of fundamental matrix using the RANSAC algorithm
int point_count = 100;
vector<Point2f> points1(point_count);
vector<Point2f> points2(point_count);
// initialize the points here ...
for( int i = 0; i < point_count; i++ )
{
points1[i] = ...;
points2[i] = ...;
}
// Input: camera calibration of both cameras, for example using intrinsic chessboard calibration.
Mat cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2;
// Output: Essential matrix, relative rotation and relative translation.
Mat E, R, t, mask;
recoverPose(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, E, R, t, mask);

Python prototype (for reference):

recoverPose(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2[, E[, R[, t[, method[, prob[, threshold[, mask]]]]]]]) -> retval, E, R, t, mask
Link to this function

rectangle(img, rec, color)

View Source
Positional Arguments
  • img: UMat
  • rec: Rect
  • color: Scalar
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Has overloading in C++

use rec parameter as alternative specification of the drawn rectangle: r.tl() and r.br()-Point(1,1) are opposite corners

Python prototype (for reference):

rectangle(img, rec, color[, thickness[, lineType[, shift]]]) -> img
Link to this function

rectangle(img, rec, color, opts)

View Source

Variaint 1:

Positional Arguments
  • img: UMat. Image.
  • pt1: Point.
  • pt2: Point.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a simple, thick, or filled up-right rectangle. The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners are pt1 and pt2.

mean that the function has to draw a filled rectangle.

Python prototype (for reference):

rectangle(img, pt1, pt2, color[, thickness[, lineType[, shift]]]) -> img

Variaint 2:

Positional Arguments
  • img: UMat
  • rec: Rect
  • color: Scalar
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Has overloading in C++

use rec parameter as alternative specification of the drawn rectangle: r.tl() and r.br()-Point(1,1) are opposite corners

Python prototype (for reference):

rectangle(img, rec, color[, thickness[, lineType[, shift]]]) -> img
Link to this function

rectangle(img, pt1, pt2, color, opts)

View Source
Positional Arguments
  • img: UMat. Image.
  • pt1: Point.
  • pt2: Point.
  • color: Scalar.
Keyword Arguments
  • thickness: int.
  • lineType: int.
  • shift: int.

Draws a simple, thick, or filled up-right rectangle. The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners are pt1 and pt2.

mean that the function has to draw a filled rectangle.

Python prototype (for reference):

rectangle(img, pt1, pt2, color[, thickness[, lineType[, shift]]]) -> img
Link to this function

rectify3Collinear(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, cameraMatrix3, distCoeffs3, imgpt1, imgpt3, imageSize, r12, t12, r13, t13, alpha, newImgSize, flags)

View Source
Positional Arguments
  • cameraMatrix1: UMat
  • distCoeffs1: UMat
  • cameraMatrix2: UMat
  • distCoeffs2: UMat
  • cameraMatrix3: UMat
  • distCoeffs3: UMat
  • imgpt1: vector_UMat
  • imgpt3: vector_UMat
  • imageSize: Size
  • r12: UMat
  • t12: UMat
  • r13: UMat
  • t13: UMat
  • alpha: double
  • newImgSize: Size
  • flags: int
Keyword Arguments
  • r1: UMat.
  • r2: UMat.
  • r3: UMat.
  • p1: UMat.
  • p2: UMat.
  • p3: UMat.
  • q: UMat.

Python prototype (for reference):

rectify3Collinear(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, cameraMatrix3, distCoeffs3, imgpt1, imgpt3, imageSize, R12, T12, R13, T13, alpha, newImgSize, flags[, R1[, R2[, R3[, P1[, P2[, P3[, Q]]]]]]]) -> retval, R1, R2, R3, P1, P2, P3, Q, roi1, roi2
Link to this function

rectify3Collinear(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, cameraMatrix3, distCoeffs3, imgpt1, imgpt3, imageSize, r12, t12, r13, t13, alpha, newImgSize, flags, opts)

View Source
Positional Arguments
  • cameraMatrix1: UMat
  • distCoeffs1: UMat
  • cameraMatrix2: UMat
  • distCoeffs2: UMat
  • cameraMatrix3: UMat
  • distCoeffs3: UMat
  • imgpt1: vector_UMat
  • imgpt3: vector_UMat
  • imageSize: Size
  • r12: UMat
  • t12: UMat
  • r13: UMat
  • t13: UMat
  • alpha: double
  • newImgSize: Size
  • flags: int
Keyword Arguments
  • r1: UMat.
  • r2: UMat.
  • r3: UMat.
  • p1: UMat.
  • p2: UMat.
  • p3: UMat.
  • q: UMat.

Python prototype (for reference):

rectify3Collinear(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, cameraMatrix3, distCoeffs3, imgpt1, imgpt3, imageSize, R12, T12, R13, T13, alpha, newImgSize, flags[, R1[, R2[, R3[, P1[, P2[, P3[, Q]]]]]]]) -> retval, R1, R2, R3, P1, P2, P3, Q, roi1, roi2
Positional Arguments
  • src: UMat.
  • dim: int.
  • rtype: int.
Keyword Arguments
  • dst: UMat.
  • dtype: int.

Reduces a matrix to a vector. The function #reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained. For example, the function can be used to compute horizontal and vertical projections of a raster image. In case of #REDUCE_MAX and #REDUCE_MIN , the output image should have the same type as the source one. In case of #REDUCE_SUM and #REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction modes. The following code demonstrates its usage for a single channel matrix. @snippet snippets/core_reduce.cpp example And the following code demonstrates its usage for a two-channel matrix. @snippet snippets/core_reduce.cpp example2

a single row. 1 means that the matrix is reduced to a single column.
otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()).

@sa repeat, reduceArgMin, reduceArgMax

Python prototype (for reference):

reduce(src, dim, rtype[, dst[, dtype]]) -> dst
Link to this function

reduce(src, dim, rtype, opts)

View Source
Positional Arguments
  • src: UMat.
  • dim: int.
  • rtype: int.
Keyword Arguments
  • dst: UMat.
  • dtype: int.

Reduces a matrix to a vector. The function #reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained. For example, the function can be used to compute horizontal and vertical projections of a raster image. In case of #REDUCE_MAX and #REDUCE_MIN , the output image should have the same type as the source one. In case of #REDUCE_SUM and #REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction modes. The following code demonstrates its usage for a single channel matrix. @snippet snippets/core_reduce.cpp example And the following code demonstrates its usage for a two-channel matrix. @snippet snippets/core_reduce.cpp example2

a single row. 1 means that the matrix is reduced to a single column.
otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()).

@sa repeat, reduceArgMin, reduceArgMax

Python prototype (for reference):

reduce(src, dim, rtype[, dst[, dtype]]) -> dst
Positional Arguments
  • src: UMat.
  • axis: int.
Keyword Arguments
  • dst: UMat.
  • lastIndex: bool.

Finds indices of max elements along provided axis Note:

    - If input or output array is not continuous, this function will create an internal copy.
    - NaN handling is left unspecified, see patchNaNs().
    - The returned index is always in bounds of input matrix.
 except for axis being reduced - it should be set to 1.

@sa reduceArgMin, minMaxLoc, min, max, compare, reduce

Python prototype (for reference):

reduceArgMax(src, axis[, dst[, lastIndex]]) -> dst
Link to this function

reduceArgMax(src, axis, opts)

View Source
Positional Arguments
  • src: UMat.
  • axis: int.
Keyword Arguments
  • dst: UMat.
  • lastIndex: bool.

Finds indices of max elements along provided axis Note:

    - If input or output array is not continuous, this function will create an internal copy.
    - NaN handling is left unspecified, see patchNaNs().
    - The returned index is always in bounds of input matrix.
 except for axis being reduced - it should be set to 1.

@sa reduceArgMin, minMaxLoc, min, max, compare, reduce

Python prototype (for reference):

reduceArgMax(src, axis[, dst[, lastIndex]]) -> dst
Positional Arguments
  • src: UMat.
  • axis: int.
Keyword Arguments
  • dst: UMat.
  • lastIndex: bool.

Finds indices of min elements along provided axis Note:

    - If input or output array is not continuous, this function will create an internal copy.
    - NaN handling is left unspecified, see patchNaNs().
    - The returned index is always in bounds of input matrix.
 except for axis being reduced - it should be set to 1.

@sa reduceArgMax, minMaxLoc, min, max, compare, reduce

Python prototype (for reference):

reduceArgMin(src, axis[, dst[, lastIndex]]) -> dst
Link to this function

reduceArgMin(src, axis, opts)

View Source
Positional Arguments
  • src: UMat.
  • axis: int.
Keyword Arguments
  • dst: UMat.
  • lastIndex: bool.

Finds indices of min elements along provided axis Note:

    - If input or output array is not continuous, this function will create an internal copy.
    - NaN handling is left unspecified, see patchNaNs().
    - The returned index is always in bounds of input matrix.
 except for axis being reduced - it should be set to 1.

@sa reduceArgMax, minMaxLoc, min, max, compare, reduce

Python prototype (for reference):

reduceArgMin(src, axis[, dst[, lastIndex]]) -> dst
Link to this function

remap(src, map1, map2, interpolation)

View Source
Positional Arguments
  • src: UMat.
  • map1: UMat.
  • map2: UMat.
  • interpolation: int.
Keyword Arguments
  • dst: UMat.
  • borderMode: int.
  • borderValue: Scalar.

Applies a generic geometrical transformation to an image. The function remap transforms the source image using the specified map: \f[\texttt{dst} (x,y) = \texttt{src} (map_x(x,y),map_y(x,y))\f] where values of pixels with non-integer coordinates are computed using one of available interpolation methods. \f$map_x\f$ and \f$map_y\f$ can be encoded as separate floating-point maps in \f$map_1\f$ and \f$map_2\f$ respectively, or interleaved floating-point maps of \f$(x,y)\f$ in \f$map_1\f$, or fixed-point maps created by using #convertMaps. The reason you might want to convert from floating to fixed-point representations of a map is that they can yield much faster (\~2x) remapping operations. In the converted case, \f$map_1\f$ contains pairs (cvFloor(x), cvFloor(y)) and \f$map_2\f$ contains indices in a table of interpolation coefficients. This function cannot operate in-place.

CV_32FC1, or CV_32FC2. See #convertMaps for details on converting a floating point
representation to fixed-point for speed.
if map1 is (x,y) points), respectively.
and #INTER_LINEAR_EXACT are not supported by this function.
borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image that
corresponds to the "outliers" in the source image are not modified by the function.

Note: Due to current implementation limitations the size of an input and output images should be less than 32767x32767.

Python prototype (for reference):

remap(src, map1, map2, interpolation[, dst[, borderMode[, borderValue]]]) -> dst
Link to this function

remap(src, map1, map2, interpolation, opts)

View Source
Positional Arguments
  • src: UMat.
  • map1: UMat.
  • map2: UMat.
  • interpolation: int.
Keyword Arguments
  • dst: UMat.
  • borderMode: int.
  • borderValue: Scalar.

Applies a generic geometrical transformation to an image. The function remap transforms the source image using the specified map: \f[\texttt{dst} (x,y) = \texttt{src} (map_x(x,y),map_y(x,y))\f] where values of pixels with non-integer coordinates are computed using one of available interpolation methods. \f$map_x\f$ and \f$map_y\f$ can be encoded as separate floating-point maps in \f$map_1\f$ and \f$map_2\f$ respectively, or interleaved floating-point maps of \f$(x,y)\f$ in \f$map_1\f$, or fixed-point maps created by using #convertMaps. The reason you might want to convert from floating to fixed-point representations of a map is that they can yield much faster (\~2x) remapping operations. In the converted case, \f$map_1\f$ contains pairs (cvFloor(x), cvFloor(y)) and \f$map_2\f$ contains indices in a table of interpolation coefficients. This function cannot operate in-place.

CV_32FC1, or CV_32FC2. See #convertMaps for details on converting a floating point
representation to fixed-point for speed.
if map1 is (x,y) points), respectively.
and #INTER_LINEAR_EXACT are not supported by this function.
borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image that
corresponds to the "outliers" in the source image are not modified by the function.

Note: Due to current implementation limitations the size of an input and output images should be less than 32767x32767.

Python prototype (for reference):

remap(src, map1, map2, interpolation[, dst[, borderMode[, borderValue]]]) -> dst
Positional Arguments
  • src: UMat.
  • ny: int.
  • nx: int.
Keyword Arguments
  • dst: UMat.

Fills the output array with repeated copies of the input array. The function cv::repeat duplicates the input array one or more times along each of the two axes: \f[\texttt{dst} _{ij}= \texttt{src} _{i\mod src.rows, \; j\mod src.cols }\f] The second variant of the function is more convenient to use with @ref MatrixExpressions.

vertical axis.
horizontal axis.

@sa cv::reduce

Python prototype (for reference):

repeat(src, ny, nx[, dst]) -> dst
Link to this function

repeat(src, ny, nx, opts)

View Source
Positional Arguments
  • src: UMat.
  • ny: int.
  • nx: int.
Keyword Arguments
  • dst: UMat.

Fills the output array with repeated copies of the input array. The function cv::repeat duplicates the input array one or more times along each of the two axes: \f[\texttt{dst} _{ij}= \texttt{src} _{i\mod src.rows, \; j\mod src.cols }\f] The second variant of the function is more convenient to use with @ref MatrixExpressions.

vertical axis.
horizontal axis.

@sa cv::reduce

Python prototype (for reference):

repeat(src, ny, nx[, dst]) -> dst
Link to this function

reprojectImageTo3D(disparity, q)

View Source
Positional Arguments
  • disparity: UMat.
  • q: UMat.
Keyword Arguments
  • 3dImage: UMat.
  • handleMissingValues: bool.
  • ddepth: int.

Reprojects a disparity image to 3D space.

floating-point disparity image. The values of 8-bit / 16-bit signed formats are assumed to have no
fractional bits. If the disparity is 16-bit signed format, as computed by @ref StereoBM or

@ref StereoSGBM and maybe other algorithms, it should be divided by 16 (and scaled to float) before being used here.

_3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map. If one
uses Q obtained by @ref stereoRectify, then the returned points are represented in the first
camera's rectified coordinate system.

@ref stereoRectify.

points where the disparity was not computed). If handleMissingValues=true, then pixels with the
minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed
to 3D points with a very large Z value (currently set to 10000).
depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.

The function transforms a single-channel disparity map to a 3-channel image representing a 3D surface. That is, for each pixel (x,y) and the corresponding disparity d=disparity(x,y) , it computes: \f[\begin{bmatrix} X \\ Y \\ Z \\ W \end{bmatrix} = Q \begin{bmatrix} x \\ y \\ \texttt{disparity} (x,y) \\ z \end{bmatrix}.\f] @sa To reproject a sparse set of points {(x,y,d),...} to 3D space, use perspectiveTransform.

Python prototype (for reference):

reprojectImageTo3D(disparity, Q[, _3dImage[, handleMissingValues[, ddepth]]]) -> _3dImage
Link to this function

reprojectImageTo3D(disparity, q, opts)

View Source
Positional Arguments
  • disparity: UMat.
  • q: UMat.
Keyword Arguments
  • 3dImage: UMat.
  • handleMissingValues: bool.
  • ddepth: int.

Reprojects a disparity image to 3D space.

floating-point disparity image. The values of 8-bit / 16-bit signed formats are assumed to have no
fractional bits. If the disparity is 16-bit signed format, as computed by @ref StereoBM or

@ref StereoSGBM and maybe other algorithms, it should be divided by 16 (and scaled to float) before being used here.

_3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map. If one
uses Q obtained by @ref stereoRectify, then the returned points are represented in the first
camera's rectified coordinate system.

@ref stereoRectify.

points where the disparity was not computed). If handleMissingValues=true, then pixels with the
minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed
to 3D points with a very large Z value (currently set to 10000).
depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.

The function transforms a single-channel disparity map to a 3-channel image representing a 3D surface. That is, for each pixel (x,y) and the corresponding disparity d=disparity(x,y) , it computes: \f[\begin{bmatrix} X \\ Y \\ Z \\ W \end{bmatrix} = Q \begin{bmatrix} x \\ y \\ \texttt{disparity} (x,y) \\ z \end{bmatrix}.\f] @sa To reproject a sparse set of points {(x,y,d),...} to 3D space, use perspectiveTransform.

Python prototype (for reference):

reprojectImageTo3D(disparity, Q[, _3dImage[, handleMissingValues[, ddepth]]]) -> _3dImage
Positional Arguments
  • src: UMat.
  • dsize: Size.
Keyword Arguments
  • dst: UMat.
  • fx: double.
  • fy: double.
  • interpolation: int.

Resizes an image. The function resize resizes the image src down to or up to the specified size. Note that the initial dst type or size are not taken into account. Instead, the size and type are derived from the src,dsize,fx, and fy. If you want to resize src so that it fits the pre-created dst, you may call the function as follows:

// explicitly specify dsize=dst.size(); fx and fy will be computed from that.
resize(src, dst, dst.size(), 0, 0, interpolation);

If you want to decimate the image by factor of 2 in each direction, you can call the function this way:

// specify fx and fy and let the function compute the destination image size.
resize(src, dst, Size(), 0.5, 0.5, interpolation);

To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to enlarge an image, it will generally look best with #INTER_CUBIC (slow) or #INTER_LINEAR (faster but still looks OK).

src.size(), fx, and fy; the type of dst is the same as of src.
\f[\texttt{dsize = Size(round(fx\*src.cols), round(fy\*src.rows))}\f]
Either dsize or both fx and fy must be non-zero.
\f[\texttt{(double)dsize.width/src.cols}\f]
\f[\texttt{(double)dsize.height/src.rows}\f]

@sa warpAffine, warpPerspective, remap

Python prototype (for reference):

resize(src, dsize[, dst[, fx[, fy[, interpolation]]]]) -> dst
Link to this function

resize(src, dsize, opts)

View Source
Positional Arguments
  • src: UMat.
  • dsize: Size.
Keyword Arguments
  • dst: UMat.
  • fx: double.
  • fy: double.
  • interpolation: int.

Resizes an image. The function resize resizes the image src down to or up to the specified size. Note that the initial dst type or size are not taken into account. Instead, the size and type are derived from the src,dsize,fx, and fy. If you want to resize src so that it fits the pre-created dst, you may call the function as follows:

// explicitly specify dsize=dst.size(); fx and fy will be computed from that.
resize(src, dst, dst.size(), 0, 0, interpolation);

If you want to decimate the image by factor of 2 in each direction, you can call the function this way:

// specify fx and fy and let the function compute the destination image size.
resize(src, dst, Size(), 0.5, 0.5, interpolation);

To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to enlarge an image, it will generally look best with #INTER_CUBIC (slow) or #INTER_LINEAR (faster but still looks OK).

src.size(), fx, and fy; the type of dst is the same as of src.
\f[\texttt{dsize = Size(round(fx\*src.cols), round(fy\*src.rows))}\f]
Either dsize or both fx and fy must be non-zero.
\f[\texttt{(double)dsize.width/src.cols}\f]
\f[\texttt{(double)dsize.height/src.rows}\f]

@sa warpAffine, warpPerspective, remap

Python prototype (for reference):

resize(src, dsize[, dst[, fx[, fy[, interpolation]]]]) -> dst
Link to this function

resizeWindow(winname, size)

View Source

Has overloading in C++

Python prototype (for reference):

resizeWindow(winname, size) -> None
Link to this function

resizeWindow(winname, width, height)

View Source

Resizes the window to the specified size Note:

  • The specified window size is for the image area. Toolbars are not counted.
  • Only windows created without cv::WINDOW_AUTOSIZE flag can be resized.

Python prototype (for reference):

resizeWindow(winname, width, height) -> None
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • jacobian: UMat.

Converts a rotation matrix to a rotation vector or vice versa.

derivatives of the output array components with respect to the input array components.

\f[\begin{array}{l} \theta \leftarrow norm(r) \\ r \leftarrow r/ \theta \\ R = \cos(\theta) I + (1- \cos{\theta} ) r r^T + \sin(\theta) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} \end{array}\f] Inverse transformation can be also done easily, since \f[\sin ( \theta ) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} = \frac{R - R^T}{2}\f] A rotation vector is a convenient and most compact representation of a rotation matrix (since any rotation matrix has just 3 degrees of freedom). The representation is used in the global 3D geometry optimization procedures like @ref calibrateCamera, @ref stereoCalibrate, or @ref solvePnP . Note: More information about the computation of the derivative of a 3D rotation matrix with respect to its exponential coordinate can be found in:

  • A Compact Formula for the Derivative of a 3-D Rotation in Exponential Coordinates, Guillermo Gallego, Anthony J. Yezzi @cite Gallego2014ACF Note: Useful information on SE(3) and Lie Groups can be found in:
  • A tutorial on SE(3) transformation parameterizations and on-manifold optimization, Jose-Luis Blanco @cite blanco2010tutorial
  • Lie Groups for 2D and 3D Transformation, Ethan Eade @cite Eade17
  • A micro Lie theory for state estimation in robotics, Joan Solà, Jérémie Deray, Dinesh Atchuthan @cite Sol2018AML

Python prototype (for reference):

Rodrigues(src[, dst[, jacobian]]) -> dst, jacobian
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • jacobian: UMat.

Converts a rotation matrix to a rotation vector or vice versa.

derivatives of the output array components with respect to the input array components.

\f[\begin{array}{l} \theta \leftarrow norm(r) \\ r \leftarrow r/ \theta \\ R = \cos(\theta) I + (1- \cos{\theta} ) r r^T + \sin(\theta) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} \end{array}\f] Inverse transformation can be also done easily, since \f[\sin ( \theta ) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} = \frac{R - R^T}{2}\f] A rotation vector is a convenient and most compact representation of a rotation matrix (since any rotation matrix has just 3 degrees of freedom). The representation is used in the global 3D geometry optimization procedures like @ref calibrateCamera, @ref stereoCalibrate, or @ref solvePnP . Note: More information about the computation of the derivative of a 3D rotation matrix with respect to its exponential coordinate can be found in:

  • A Compact Formula for the Derivative of a 3-D Rotation in Exponential Coordinates, Guillermo Gallego, Anthony J. Yezzi @cite Gallego2014ACF Note: Useful information on SE(3) and Lie Groups can be found in:
  • A tutorial on SE(3) transformation parameterizations and on-manifold optimization, Jose-Luis Blanco @cite blanco2010tutorial
  • Lie Groups for 2D and 3D Transformation, Ethan Eade @cite Eade17
  • A micro Lie theory for state estimation in robotics, Joan Solà, Jérémie Deray, Dinesh Atchuthan @cite Sol2018AML

Python prototype (for reference):

Rodrigues(src[, dst[, jacobian]]) -> dst, jacobian
Positional Arguments
  • src: UMat.
  • rotateCode: int.
Keyword Arguments
  • dst: UMat.

Rotates a 2D array in multiples of 90 degrees. The function cv::rotate rotates the array in one of three different ways:

 Rotate by 90 degrees clockwise (rotateCode = ROTATE_90_CLOCKWISE).
 Rotate by 180 degrees clockwise (rotateCode = ROTATE_180).
 Rotate by 270 degrees clockwise (rotateCode = ROTATE_90_COUNTERCLOCKWISE).
and the rows and cols are switched for ROTATE_90_CLOCKWISE and ROTATE_90_COUNTERCLOCKWISE.

@sa transpose , repeat , completeSymm, flip, RotateFlags

Python prototype (for reference):

rotate(src, rotateCode[, dst]) -> dst
Link to this function

rotate(src, rotateCode, opts)

View Source
Positional Arguments
  • src: UMat.
  • rotateCode: int.
Keyword Arguments
  • dst: UMat.

Rotates a 2D array in multiples of 90 degrees. The function cv::rotate rotates the array in one of three different ways:

 Rotate by 90 degrees clockwise (rotateCode = ROTATE_90_CLOCKWISE).
 Rotate by 180 degrees clockwise (rotateCode = ROTATE_180).
 Rotate by 270 degrees clockwise (rotateCode = ROTATE_90_COUNTERCLOCKWISE).
and the rows and cols are switched for ROTATE_90_CLOCKWISE and ROTATE_90_COUNTERCLOCKWISE.

@sa transpose , repeat , completeSymm, flip, RotateFlags

Python prototype (for reference):

rotate(src, rotateCode[, dst]) -> dst
Link to this function

rotatedRectangleIntersection(rect1, rect2)

View Source
Positional Arguments
  • rect1: RotatedRect.
  • rect2: RotatedRect.
Keyword Arguments
  • intersectingRegion: UMat.

Finds out if there is any intersection between two rotated rectangles. If there is then the vertices of the intersecting region are returned as well. Below are some examples of intersection configurations. The hatched pattern indicates the intersecting region and the red vertices are returned by the function. intersection examples

at most 8 vertices. Stored as std::vector\<cv::Point2f\> or cv::Mat as Mx1 of type CV_32FC2.

@returns One of #RectanglesIntersectTypes

Python prototype (for reference):

rotatedRectangleIntersection(rect1, rect2[, intersectingRegion]) -> retval, intersectingRegion
Link to this function

rotatedRectangleIntersection(rect1, rect2, opts)

View Source
Positional Arguments
  • rect1: RotatedRect.
  • rect2: RotatedRect.
Keyword Arguments
  • intersectingRegion: UMat.

Finds out if there is any intersection between two rotated rectangles. If there is then the vertices of the intersecting region are returned as well. Below are some examples of intersection configurations. The hatched pattern indicates the intersecting region and the red vertices are returned by the function. intersection examples

at most 8 vertices. Stored as std::vector\<cv::Point2f\> or cv::Mat as Mx1 of type CV_32FC2.

@returns One of #RectanglesIntersectTypes

Python prototype (for reference):

rotatedRectangleIntersection(rect1, rect2[, intersectingRegion]) -> retval, intersectingRegion
Positional Arguments
  • src: UMat.
Keyword Arguments
  • mtxR: UMat.
  • mtxQ: UMat.
  • qx: UMat.
  • qy: UMat.
  • qz: UMat.

Computes an RQ decomposition of 3x3 matrices. The function computes a RQ decomposition using the given rotations. This function is used in #decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera and a rotation matrix. It optionally returns three rotation matrices, one for each axis, and the three Euler angles in degrees (as the return value) that could be used in OpenGL. Note, there is always more than one sequence of rotations about the three principal axes that results in the same orientation of an object, e.g. see @cite Slabaugh . Returned tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.

Python prototype (for reference):

RQDecomp3x3(src[, mtxR[, mtxQ[, Qx[, Qy[, Qz]]]]]) -> retval, mtxR, mtxQ, Qx, Qy, Qz
Positional Arguments
  • src: UMat.
Keyword Arguments
  • mtxR: UMat.
  • mtxQ: UMat.
  • qx: UMat.
  • qy: UMat.
  • qz: UMat.

Computes an RQ decomposition of 3x3 matrices. The function computes a RQ decomposition using the given rotations. This function is used in #decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera and a rotation matrix. It optionally returns three rotation matrices, one for each axis, and the three Euler angles in degrees (as the return value) that could be used in OpenGL. Note, there is always more than one sequence of rotations about the three principal axes that results in the same orientation of an object, e.g. see @cite Slabaugh . Returned tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.

Python prototype (for reference):

RQDecomp3x3(src[, mtxR[, mtxQ[, Qx[, Qy[, Qz]]]]]) -> retval, mtxR, mtxQ, Qx, Qy, Qz
Link to this function

sampsonDistance(pt1, pt2, f)

View Source

Calculates the Sampson Distance between two points. The function cv::sampsonDistance calculates and returns the first order approximation of the geometric error as: \f[ sd( \texttt{pt1} , \texttt{pt2} )= \frac{(\texttt{pt2}^t \cdot \texttt{F} \cdot \texttt{pt1})^2} {((\texttt{F} \cdot \texttt{pt1})(0))^2 + ((\texttt{F} \cdot \texttt{pt1})(1))^2 + ((\texttt{F}^t \cdot \texttt{pt2})(0))^2 + ((\texttt{F}^t \cdot \texttt{pt2})(1))^2} \f] The fundamental matrix may be calculated using the #findFundamentalMat function. See @cite HartleyZ00 11.4.3 for details. @return The computed Sampson distance.

Python prototype (for reference):

sampsonDistance(pt1, pt2, F) -> retval
Link to this function

scaleAdd(src1, alpha, src2)

View Source
Positional Arguments
  • src1: UMat.
  • alpha: double.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the sum of a scaled array and another array. The function scaleAdd is one of the classical primitive linear algebra operations, known as DAXPY or SAXPY in BLAS. It calculates the sum of a scaled array and another array: \f[\texttt{dst} (I)= \texttt{scale} \cdot \texttt{src1} (I) + \texttt{src2} (I)\f] The function can also be emulated with a matrix expression, for example:

Mat A(3, 3, CV_64F);
...
A.row(0) = A.row(1)*2 + A.row(2);

@sa add, addWeighted, subtract, Mat::dot, Mat::convertTo

Python prototype (for reference):

scaleAdd(src1, alpha, src2[, dst]) -> dst
Link to this function

scaleAdd(src1, alpha, src2, opts)

View Source
Positional Arguments
  • src1: UMat.
  • alpha: double.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.

Calculates the sum of a scaled array and another array. The function scaleAdd is one of the classical primitive linear algebra operations, known as DAXPY or SAXPY in BLAS. It calculates the sum of a scaled array and another array: \f[\texttt{dst} (I)= \texttt{scale} \cdot \texttt{src1} (I) + \texttt{src2} (I)\f] The function can also be emulated with a matrix expression, for example:

Mat A(3, 3, CV_64F);
...
A.row(0) = A.row(1)*2 + A.row(2);

@sa add, addWeighted, subtract, Mat::dot, Mat::convertTo

Python prototype (for reference):

scaleAdd(src1, alpha, src2[, dst]) -> dst
Link to this function

scharr(src, ddepth, dx, dy)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
  • dx: int.
  • dy: int.
Keyword Arguments
  • dst: UMat.
  • scale: double.
  • delta: double.
  • borderType: int.

Calculates the first x- or y- image derivative using Scharr operator. The function computes the first x- or y- spatial image derivative using the Scharr operator. The call \f[\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\f] is equivalent to \f[\texttt{Sobel(src, dst, ddepth, dx, dy, FILTER_SCHARR, scale, delta, borderType)} .\f]

applied (see #getDerivKernels for details).

@sa cartToPolar

Python prototype (for reference):

Scharr(src, ddepth, dx, dy[, dst[, scale[, delta[, borderType]]]]) -> dst
Link to this function

scharr(src, ddepth, dx, dy, opts)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
  • dx: int.
  • dy: int.
Keyword Arguments
  • dst: UMat.
  • scale: double.
  • delta: double.
  • borderType: int.

Calculates the first x- or y- image derivative using Scharr operator. The function computes the first x- or y- spatial image derivative using the Scharr operator. The call \f[\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\f] is equivalent to \f[\texttt{Sobel(src, dst, ddepth, dx, dy, FILTER_SCHARR, scale, delta, borderType)} .\f]

applied (see #getDerivKernels for details).

@sa cartToPolar

Python prototype (for reference):

Scharr(src, ddepth, dx, dy[, dst[, scale[, delta[, borderType]]]]) -> dst
Link to this function

seamlessClone(src, dst, mask, p, flags)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
  • mask: UMat.
  • p: Point.
  • flags: int.
Keyword Arguments
  • blend: UMat.

Image editing tasks concern either global changes (color/intensity corrections, filters, deformations) or local changes concerned to a selection. Here we are interested in achieving local changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless manner. The extent of the changes ranges from slight distortions to complete replacement by novel content @cite PM03 .

Python prototype (for reference):

seamlessClone(src, dst, mask, p, flags[, blend]) -> blend
Link to this function

seamlessClone(src, dst, mask, p, flags, opts)

View Source
Positional Arguments
  • src: UMat.
  • dst: UMat.
  • mask: UMat.
  • p: Point.
  • flags: int.
Keyword Arguments
  • blend: UMat.

Image editing tasks concern either global changes (color/intensity corrections, filters, deformations) or local changes concerned to a selection. Here we are interested in achieving local changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless manner. The extent of the changes ranges from slight distortions to complete replacement by novel content @cite PM03 .

Python prototype (for reference):

seamlessClone(src, dst, mask, p, flags[, blend]) -> blend
Positional Arguments
  • img: UMat
Keyword Arguments
  • showCrosshair: bool.
  • fromCenter: bool.

Has overloading in C++

Python prototype (for reference):

selectROI(img[, showCrosshair[, fromCenter]]) -> retval

Variaint 1:

Positional Arguments
  • windowName: String.
  • img: UMat.
Keyword Arguments
  • showCrosshair: bool.
  • fromCenter: bool.

Allows users to select a ROI on the given image. The function creates a window and allows users to select a ROI using the mouse. Controls: use space or enter to finish selection, use key c to cancel selection (function will return the zero cv::Rect).

selection rectangle will correspont to the initial mouse position.

@return selected ROI or empty rect if selection canceled. Note: The function sets it's own mouse callback for specified window using cv::setMouseCallback(windowName, ...). After finish of work an empty callback will be set for the used window.

Python prototype (for reference):

selectROI(windowName, img[, showCrosshair[, fromCenter]]) -> retval

Variaint 2:

Positional Arguments
  • img: UMat
Keyword Arguments
  • showCrosshair: bool.
  • fromCenter: bool.

Has overloading in C++

Python prototype (for reference):

selectROI(img[, showCrosshair[, fromCenter]]) -> retval
Link to this function

selectROI(windowName, img, opts)

View Source
Positional Arguments
  • windowName: String.
  • img: UMat.
Keyword Arguments
  • showCrosshair: bool.
  • fromCenter: bool.

Allows users to select a ROI on the given image. The function creates a window and allows users to select a ROI using the mouse. Controls: use space or enter to finish selection, use key c to cancel selection (function will return the zero cv::Rect).

selection rectangle will correspont to the initial mouse position.

@return selected ROI or empty rect if selection canceled. Note: The function sets it's own mouse callback for specified window using cv::setMouseCallback(windowName, ...). After finish of work an empty callback will be set for the used window.

Python prototype (for reference):

selectROI(windowName, img[, showCrosshair[, fromCenter]]) -> retval
Link to this function

selectROIs(windowName, img)

View Source
Positional Arguments
  • windowName: String.
  • img: UMat.
Keyword Arguments
  • showCrosshair: bool.
  • fromCenter: bool.

Allows users to select multiple ROIs on the given image. The function creates a window and allows users to select multiple ROIs using the mouse. Controls: use space or enter to finish current selection and start a new one, use esc to terminate multiple ROI selection process.

selection rectangle will correspont to the initial mouse position.

Note: The function sets it's own mouse callback for specified window using cv::setMouseCallback(windowName, ...). After finish of work an empty callback will be set for the used window.

Python prototype (for reference):

selectROIs(windowName, img[, showCrosshair[, fromCenter]]) -> boundingBoxes
Link to this function

selectROIs(windowName, img, opts)

View Source
Positional Arguments
  • windowName: String.
  • img: UMat.
Keyword Arguments
  • showCrosshair: bool.
  • fromCenter: bool.

Allows users to select multiple ROIs on the given image. The function creates a window and allows users to select multiple ROIs using the mouse. Controls: use space or enter to finish current selection and start a new one, use esc to terminate multiple ROI selection process.

selection rectangle will correspont to the initial mouse position.

Note: The function sets it's own mouse callback for specified window using cv::setMouseCallback(windowName, ...). After finish of work an empty callback will be set for the used window.

Python prototype (for reference):

selectROIs(windowName, img[, showCrosshair[, fromCenter]]) -> boundingBoxes
Link to this function

sepFilter2D(src, ddepth, kernelX, kernelY)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
  • kernelX: UMat.
  • kernelY: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • delta: double.
  • borderType: int.

Applies a separable linear filter to an image. The function applies a separable linear filter to the image. That is, first, every row of src is filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D kernel kernelY. The final result shifted by delta is stored in dst .

is at the kernel center.

@sa filter2D, Sobel, GaussianBlur, boxFilter, blur

Python prototype (for reference):

sepFilter2D(src, ddepth, kernelX, kernelY[, dst[, anchor[, delta[, borderType]]]]) -> dst
Link to this function

sepFilter2D(src, ddepth, kernelX, kernelY, opts)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
  • kernelX: UMat.
  • kernelY: UMat.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • delta: double.
  • borderType: int.

Applies a separable linear filter to an image. The function applies a separable linear filter to the image. That is, first, every row of src is filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D kernel kernelY. The final result shifted by delta is stored in dst .

is at the kernel center.

@sa filter2D, Sobel, GaussianBlur, boxFilter, blur

Python prototype (for reference):

sepFilter2D(src, ddepth, kernelX, kernelY[, dst[, anchor[, delta[, borderType]]]]) -> dst
Positional Arguments
  • mtx: UMat.
Keyword Arguments
  • s: Scalar.

Initializes a scaled identity matrix. The function cv::setIdentity initializes a scaled identity matrix: \f[\texttt{mtx} (i,j)= \fork{\texttt{value}}{ if (i=j)}{0}{otherwise}\f] The function can also be emulated using the matrix initializers and the matrix expressions:

Mat A = Mat::eye(4, 3, CV_32F)*5;
// A will be set to [[5, 0, 0], [0, 5, 0], [0, 0, 5], [0, 0, 0]]

@sa Mat::zeros, Mat::ones, Mat::setTo, Mat::operator=

Python prototype (for reference):

setIdentity(mtx[, s]) -> mtx
Positional Arguments
  • mtx: UMat.
Keyword Arguments
  • s: Scalar.

Initializes a scaled identity matrix. The function cv::setIdentity initializes a scaled identity matrix: \f[\texttt{mtx} (i,j)= \fork{\texttt{value}}{ if (i=j)}{0}{otherwise}\f] The function can also be emulated using the matrix initializers and the matrix expressions:

Mat A = Mat::eye(4, 3, CV_32F)*5;
// A will be set to [[5, 0, 0], [0, 5, 0], [0, 0, 5], [0, 0, 0]]

@sa Mat::zeros, Mat::ones, Mat::setTo, Mat::operator=

Python prototype (for reference):

setIdentity(mtx[, s]) -> mtx

Python prototype (for reference):

setLogLevel(level) -> retval

OpenCV will try to set the number of threads for the next parallel region. If threads == 0, OpenCV will disable threading optimizations and run all it's functions sequentially. Passing threads \< 0 will reset threads number to system default. This function must be called outside of parallel region. OpenCV will try to run its functions with specified threads number, but some behaviour differs from framework:

  • TBB - User-defined parallel constructions will run with the same threads number, if another is not specified. If later on user creates his own scheduler, OpenCV will use it.
  • OpenMP - No special defined behaviour.
  • Concurrency - If threads == 1, OpenCV will disable threading optimizations and run its functions sequentially.
  • GCD - Supports only values \<= 0.
  • C= - No special defined behaviour. @sa getNumThreads, getThreadNum

Python prototype (for reference):

setNumThreads(nthreads) -> None

Sets state of default random number generator. The function cv::setRNGSeed sets state of default random number generator to custom value. @sa RNG, randu, randn

Python prototype (for reference):

setRNGSeed(seed) -> None
Link to this function

setTrackbarMax(trackbarname, winname, maxval)

View Source

Sets the trackbar maximum position. The function sets the maximum position of the specified trackbar in the specified window. Note: [Qt Backend Only] winname can be empty if the trackbar is attached to the control panel.

Python prototype (for reference):

setTrackbarMax(trackbarname, winname, maxval) -> None
Link to this function

setTrackbarMin(trackbarname, winname, minval)

View Source

Sets the trackbar minimum position. The function sets the minimum position of the specified trackbar in the specified window. Note: [Qt Backend Only] winname can be empty if the trackbar is attached to the control panel.

Python prototype (for reference):

setTrackbarMin(trackbarname, winname, minval) -> None
Link to this function

setTrackbarPos(trackbarname, winname, pos)

View Source

Sets the trackbar position. The function sets the position of the specified trackbar in the specified window. Note: [Qt Backend Only] winname can be empty if the trackbar is attached to the control panel.

Python prototype (for reference):

setTrackbarPos(trackbarname, winname, pos) -> None

Python prototype (for reference):

setUseOpenVX(flag) -> None

Enables or disables the optimized code. The function can be used to dynamically turn on and off optimized dispatched code (code that uses SSE4.2, AVX/AVX2, and other instructions on the platforms that support it). It sets a global flag that is further checked by OpenCV functions. Since the flag is not checked in the inner OpenCV loops, it is only safe to call the function on the very top level in your application where you can be sure that no other OpenCV function is currently executed. By default, the optimized code is enabled unless you disable it in CMake. The current status can be retrieved using useOptimized.

or not (onoff=false).

Python prototype (for reference):

setUseOptimized(onoff) -> None
Link to this function

setWindowProperty(winname, prop_id, prop_value)

View Source

Changes parameters of a window dynamically. The function setWindowProperty enables changing properties of a window.

Python prototype (for reference):

setWindowProperty(winname, prop_id, prop_value) -> None
Link to this function

setWindowTitle(winname, title)

View Source

Updates window title

Python prototype (for reference):

setWindowTitle(winname, title) -> None
Link to this function

sobel(src, ddepth, dx, dy)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
  • dx: int.
  • dy: int.
Keyword Arguments
  • dst: UMat.
  • ksize: int.
  • scale: double.
  • delta: double.
  • borderType: int.

Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator. In all cases except one, the \f$\texttt{ksize} \times \texttt{ksize}\f$ separable kernel is used to calculate the derivative. When \f$\texttt{ksize = 1}\f$, the \f$3 \times 1\f$ or \f$1 \times 3\f$ kernel is used (that is, no Gaussian smoothing is done). ksize = 1 can only be used for the first or the second x- or y- derivatives. There is also the special value ksize = #FILTER_SCHARR (-1) that corresponds to the \f$3\times3\f$ Scharr filter that may give more accurate results than the \f$3\times3\f$ Sobel. The Scharr aperture is \f[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\f] for the x-derivative, or transposed for the y-derivative. The function calculates an image derivative by convolving the image with the appropriate kernel: \f[\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\f] The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3) or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first case corresponds to a kernel of: \f[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\f] The second case corresponds to a kernel of: \f[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\f]

8-bit input images it will result in truncated derivatives.
applied (see #getDerivKernels for details).

@sa Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar

Python prototype (for reference):

Sobel(src, ddepth, dx, dy[, dst[, ksize[, scale[, delta[, borderType]]]]]) -> dst
Link to this function

sobel(src, ddepth, dx, dy, opts)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
  • dx: int.
  • dy: int.
Keyword Arguments
  • dst: UMat.
  • ksize: int.
  • scale: double.
  • delta: double.
  • borderType: int.

Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator. In all cases except one, the \f$\texttt{ksize} \times \texttt{ksize}\f$ separable kernel is used to calculate the derivative. When \f$\texttt{ksize = 1}\f$, the \f$3 \times 1\f$ or \f$1 \times 3\f$ kernel is used (that is, no Gaussian smoothing is done). ksize = 1 can only be used for the first or the second x- or y- derivatives. There is also the special value ksize = #FILTER_SCHARR (-1) that corresponds to the \f$3\times3\f$ Scharr filter that may give more accurate results than the \f$3\times3\f$ Sobel. The Scharr aperture is \f[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\f] for the x-derivative, or transposed for the y-derivative. The function calculates an image derivative by convolving the image with the appropriate kernel: \f[\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\f] The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3) or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first case corresponds to a kernel of: \f[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\f] The second case corresponds to a kernel of: \f[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\f]

8-bit input images it will result in truncated derivatives.
applied (see #getDerivKernels for details).

@sa Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar

Python prototype (for reference):

Sobel(src, ddepth, dx, dy[, dst[, ksize[, scale[, delta[, borderType]]]]]) -> dst
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Solves one or more linear systems or least-squares problems. The function cv::solve solves a linear system or least-squares problem (the latter is possible with SVD or QR methods, or by specifying the flag #DECOMP_NORMAL ): \f[\texttt{dst} = \arg \min _X \| \texttt{src1} \cdot \texttt{X} - \texttt{src2} \|\f] If #DECOMP_LU or #DECOMP_CHOLESKY method is used, the function returns 1 if src1 (or \f$\texttt{src1}^T\texttt{src1}\f$ ) is non-singular. Otherwise, it returns 0. In the latter case, dst is not valid. Other methods find a pseudo-solution in case of a singular left-hand side part. Note: If you want to find a unity-norm solution of an under-defined singular system \f$\texttt{src1}\cdot\texttt{dst}=0\f$ , the function solve will not do the work. Use SVD::solveZ instead. @sa invert, SVD, eigen

Python prototype (for reference):

solve(src1, src2[, dst[, flags]]) -> retval, dst
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • flags: int.

Solves one or more linear systems or least-squares problems. The function cv::solve solves a linear system or least-squares problem (the latter is possible with SVD or QR methods, or by specifying the flag #DECOMP_NORMAL ): \f[\texttt{dst} = \arg \min _X \| \texttt{src1} \cdot \texttt{X} - \texttt{src2} \|\f] If #DECOMP_LU or #DECOMP_CHOLESKY method is used, the function returns 1 if src1 (or \f$\texttt{src1}^T\texttt{src1}\f$ ) is non-singular. Otherwise, it returns 0. In the latter case, dst is not valid. Other methods find a pseudo-solution in case of a singular left-hand side part. Note: If you want to find a unity-norm solution of an under-defined singular system \f$\texttt{src1}\cdot\texttt{dst}=0\f$ , the function solve will not do the work. Use SVD::solveZ instead. @sa invert, SVD, eigen

Python prototype (for reference):

solve(src1, src2[, dst[, flags]]) -> retval, dst
Positional Arguments
  • coeffs: UMat.
Keyword Arguments
  • roots: UMat.

Finds the real roots of a cubic equation. The function solveCubic finds the real roots of a cubic equation:

  • if coeffs is a 4-element vector: \f[\texttt{coeffs} [0] x^3 + \texttt{coeffs} [1] x^2 + \texttt{coeffs} [2] x + \texttt{coeffs} [3] = 0\f]
  • if coeffs is a 3-element vector: \f[x^3 + \texttt{coeffs} [0] x^2 + \texttt{coeffs} [1] x + \texttt{coeffs} [2] = 0\f] The roots are stored in the roots array. @return number of real roots. It can be 0, 1 or 2.

Python prototype (for reference):

solveCubic(coeffs[, roots]) -> retval, roots
Link to this function

solveCubic(coeffs, opts)

View Source
Positional Arguments
  • coeffs: UMat.
Keyword Arguments
  • roots: UMat.

Finds the real roots of a cubic equation. The function solveCubic finds the real roots of a cubic equation:

  • if coeffs is a 4-element vector: \f[\texttt{coeffs} [0] x^3 + \texttt{coeffs} [1] x^2 + \texttt{coeffs} [2] x + \texttt{coeffs} [3] = 0\f]
  • if coeffs is a 3-element vector: \f[x^3 + \texttt{coeffs} [0] x^2 + \texttt{coeffs} [1] x + \texttt{coeffs} [2] = 0\f] The roots are stored in the roots array. @return number of real roots. It can be 0, 1 or 2.

Python prototype (for reference):

solveCubic(coeffs[, roots]) -> retval, roots
Positional Arguments
  • func: UMat.
  • constr: UMat.
Keyword Arguments
  • z: UMat.

Solve given (non-integer) linear programming problem using the Simplex Algorithm (Simplex Method). What we mean here by "linear programming problem" (or LP problem, for short) can be formulated as: \f[\mbox{Maximize } c\cdot x\\ \mbox{Subject to:}\\ Ax\leq b\\ x\geq 0\f] Where \f$c\f$ is fixed 1-by-n row-vector, \f$A\f$ is fixed m-by-n matrix, \f$b\f$ is fixed m-by-1 column vector and \f$x\f$ is an arbitrary n-by-1 column vector, which satisfies the constraints. Simplex algorithm is one of many algorithms that are designed to handle this sort of problems efficiently. Although it is not optimal in theoretical sense (there exist algorithms that can solve any problem written as above in polynomial time, while simplex method degenerates to exponential time for some special cases), it is well-studied, easy to implement and is shown to work well for real-life purposes. The particular implementation is taken almost verbatim from Introduction to Algorithms, third edition by T. H. Cormen, C. E. Leiserson, R. L. Rivest and Clifford Stein. In particular, the Bland's rule http://en.wikipedia.org/wiki/Bland%27s_rule is used to prevent cycling.

contain 32- or 64-bit floating point numbers. As a convenience, column-vector may be also submitted,
in the latter case it is understood to correspond to \f$c^T\f$.
and the remaining to \f$A\f$. It should contain 32- or 64-bit floating point numbers.
formulation above. It will contain 64-bit floating point numbers.

@return One of cv::SolveLPResult

Python prototype (for reference):

solveLP(Func, Constr[, z]) -> retval, z
Link to this function

solveLP(func, constr, opts)

View Source
Positional Arguments
  • func: UMat.
  • constr: UMat.
Keyword Arguments
  • z: UMat.

Solve given (non-integer) linear programming problem using the Simplex Algorithm (Simplex Method). What we mean here by "linear programming problem" (or LP problem, for short) can be formulated as: \f[\mbox{Maximize } c\cdot x\\ \mbox{Subject to:}\\ Ax\leq b\\ x\geq 0\f] Where \f$c\f$ is fixed 1-by-n row-vector, \f$A\f$ is fixed m-by-n matrix, \f$b\f$ is fixed m-by-1 column vector and \f$x\f$ is an arbitrary n-by-1 column vector, which satisfies the constraints. Simplex algorithm is one of many algorithms that are designed to handle this sort of problems efficiently. Although it is not optimal in theoretical sense (there exist algorithms that can solve any problem written as above in polynomial time, while simplex method degenerates to exponential time for some special cases), it is well-studied, easy to implement and is shown to work well for real-life purposes. The particular implementation is taken almost verbatim from Introduction to Algorithms, third edition by T. H. Cormen, C. E. Leiserson, R. L. Rivest and Clifford Stein. In particular, the Bland's rule http://en.wikipedia.org/wiki/Bland%27s_rule is used to prevent cycling.

contain 32- or 64-bit floating point numbers. As a convenience, column-vector may be also submitted,
in the latter case it is understood to correspond to \f$c^T\f$.
and the remaining to \f$A\f$. It should contain 32- or 64-bit floating point numbers.
formulation above. It will contain 64-bit floating point numbers.

@return One of cv::SolveLPResult

Python prototype (for reference):

solveLP(Func, Constr[, z]) -> retval, z
Link to this function

solveP3P(objectPoints, imagePoints, cameraMatrix, distCoeffs, flags)

View Source
Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • flags: int.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.

Finds an object pose from 3 3D-2D point correspondences. @see @ref calib3d_solvePnP

1x3/3x1 3-channel. vector\<Point3f\> can be also passed here.
vector\<Point2f\> can be also passed here.
\f$\distcoeffs\f$. If the vector is NULL/empty, the zero distortion coefficients are
assumed.
the model coordinate system to the camera coordinate system. A P3P problem has up to 4 solutions.
-   @ref SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
"Complete Solution Classification for the Perspective-Three-Point Problem" (@cite gao2003complete).
-   @ref SOLVEPNP_AP3P Method is based on the paper of T. Ke and S. Roumeliotis.
"An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (@cite Ke17).

The function estimates the object pose given 3 object points, their corresponding image projections, as well as the camera intrinsic matrix and the distortion coefficients. Note: The solutions are sorted by reprojection errors (lowest to highest).

Python prototype (for reference):

solveP3P(objectPoints, imagePoints, cameraMatrix, distCoeffs, flags[, rvecs[, tvecs]]) -> retval, rvecs, tvecs
Link to this function

solveP3P(objectPoints, imagePoints, cameraMatrix, distCoeffs, flags, opts)

View Source
Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • flags: int.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.

Finds an object pose from 3 3D-2D point correspondences. @see @ref calib3d_solvePnP

1x3/3x1 3-channel. vector\<Point3f\> can be also passed here.
vector\<Point2f\> can be also passed here.
\f$\distcoeffs\f$. If the vector is NULL/empty, the zero distortion coefficients are
assumed.
the model coordinate system to the camera coordinate system. A P3P problem has up to 4 solutions.
-   @ref SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
"Complete Solution Classification for the Perspective-Three-Point Problem" (@cite gao2003complete).
-   @ref SOLVEPNP_AP3P Method is based on the paper of T. Ke and S. Roumeliotis.
"An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (@cite Ke17).

The function estimates the object pose given 3 object points, their corresponding image projections, as well as the camera intrinsic matrix and the distortion coefficients. Note: The solutions are sorted by reprojection errors (lowest to highest).

Python prototype (for reference):

solveP3P(objectPoints, imagePoints, cameraMatrix, distCoeffs, flags[, rvecs[, tvecs]]) -> retval, rvecs, tvecs
Link to this function

solvePnP(objectPoints, imagePoints, cameraMatrix, distCoeffs)

View Source
Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvec: UMat.
  • tvec: UMat.
  • useExtrinsicGuess: bool.
  • flags: int.

Finds an object pose from 3D-2D point correspondences. @see @ref calib3d_solvePnP This function returns the rotation and the translation vectors that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame, using different methods:

  • P3P methods (@ref SOLVEPNP_P3P, @ref SOLVEPNP_AP3P): need 4 input points to return a unique solution.
  • @ref SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar.
  • @ref SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation. Number of input points must be 4. Object points must be defined in the following order:
  • point 0: [-squareLength / 2, squareLength / 2, 0]
  • point 1: [ squareLength / 2, squareLength / 2, 0]
  • point 2: [ squareLength / 2, -squareLength / 2, 0]
  • point 3: [-squareLength / 2, -squareLength / 2, 0]
  • for all the other flags, number of input points must be >= 4 and object points can be in any configuration. 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d> can be also passed here. where N is the number of points. vector\<Point2d> can be also passed here. \f$\distcoeffs\f$. If the vector is NULL/empty, the zero distortion coefficients are assumed. the model coordinate system to the camera coordinate system. the provided rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further optimizes them. More information about Perspective-n-Points is described in @ref calib3d_solvePnP Note:
  • An example of how to use solvePnP for planar augmented reality can be found at opencv_source_code/samples/python/plane_ar.py
  • If you are using Python:
  • Numpy array slices won't work as input because solvePnP requires contiguous arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  • The P3P algorithm requires image points to be in an array of shape (N,1,2) due to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9) which requires 2-channel information.
  • Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints = np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  • The methods @ref SOLVEPNP_DLS and @ref SOLVEPNP_UPNP cannot be used as the current implementations are unstable and sometimes give completely wrong results. If you pass one of these two flags, @ref SOLVEPNP_EPNP method will be used instead.
  • The minimum number of points is 4 in the general case. In the case of @ref SOLVEPNP_P3P and @ref SOLVEPNP_AP3P methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  • With @ref SOLVEPNP_ITERATIVE method and useExtrinsicGuess=true, the minimum number of points is 3 (3 points are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the global solution to converge.
  • With @ref SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  • With @ref SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation. Number of input points must be 4. Object points must be defined in the following order:
  • point 0: [-squareLength / 2, squareLength / 2, 0]
  • point 1: [ squareLength / 2, squareLength / 2, 0]
  • point 2: [ squareLength / 2, -squareLength / 2, 0]
  • point 3: [-squareLength / 2, -squareLength / 2, 0]
  • With @ref SOLVEPNP_SQPNP input points must be >= 3

Python prototype (for reference):

solvePnP(objectPoints, imagePoints, cameraMatrix, distCoeffs[, rvec[, tvec[, useExtrinsicGuess[, flags]]]]) -> retval, rvec, tvec
Link to this function

solvePnP(objectPoints, imagePoints, cameraMatrix, distCoeffs, opts)

View Source
Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvec: UMat.
  • tvec: UMat.
  • useExtrinsicGuess: bool.
  • flags: int.

Finds an object pose from 3D-2D point correspondences. @see @ref calib3d_solvePnP This function returns the rotation and the translation vectors that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame, using different methods:

  • P3P methods (@ref SOLVEPNP_P3P, @ref SOLVEPNP_AP3P): need 4 input points to return a unique solution.
  • @ref SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar.
  • @ref SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation. Number of input points must be 4. Object points must be defined in the following order:
  • point 0: [-squareLength / 2, squareLength / 2, 0]
  • point 1: [ squareLength / 2, squareLength / 2, 0]
  • point 2: [ squareLength / 2, -squareLength / 2, 0]
  • point 3: [-squareLength / 2, -squareLength / 2, 0]
  • for all the other flags, number of input points must be >= 4 and object points can be in any configuration. 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d> can be also passed here. where N is the number of points. vector\<Point2d> can be also passed here. \f$\distcoeffs\f$. If the vector is NULL/empty, the zero distortion coefficients are assumed. the model coordinate system to the camera coordinate system. the provided rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further optimizes them. More information about Perspective-n-Points is described in @ref calib3d_solvePnP Note:
  • An example of how to use solvePnP for planar augmented reality can be found at opencv_source_code/samples/python/plane_ar.py
  • If you are using Python:
  • Numpy array slices won't work as input because solvePnP requires contiguous arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  • The P3P algorithm requires image points to be in an array of shape (N,1,2) due to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9) which requires 2-channel information.
  • Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints = np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  • The methods @ref SOLVEPNP_DLS and @ref SOLVEPNP_UPNP cannot be used as the current implementations are unstable and sometimes give completely wrong results. If you pass one of these two flags, @ref SOLVEPNP_EPNP method will be used instead.
  • The minimum number of points is 4 in the general case. In the case of @ref SOLVEPNP_P3P and @ref SOLVEPNP_AP3P methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  • With @ref SOLVEPNP_ITERATIVE method and useExtrinsicGuess=true, the minimum number of points is 3 (3 points are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the global solution to converge.
  • With @ref SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  • With @ref SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation. Number of input points must be 4. Object points must be defined in the following order:
  • point 0: [-squareLength / 2, squareLength / 2, 0]
  • point 1: [ squareLength / 2, squareLength / 2, 0]
  • point 2: [ squareLength / 2, -squareLength / 2, 0]
  • point 3: [-squareLength / 2, -squareLength / 2, 0]
  • With @ref SOLVEPNP_SQPNP input points must be >= 3

Python prototype (for reference):

solvePnP(objectPoints, imagePoints, cameraMatrix, distCoeffs[, rvec[, tvec[, useExtrinsicGuess[, flags]]]]) -> retval, rvec, tvec
Link to this function

solvePnPGeneric(objectPoints, imagePoints, cameraMatrix, distCoeffs)

View Source
Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • useExtrinsicGuess: bool.
  • flags: SolvePnPMethod.
  • rvec: UMat.
  • tvec: UMat.
  • reprojectionError: UMat.

Finds an object pose from 3D-2D point correspondences. @see @ref calib3d_solvePnP This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector> couple), depending on the number of input points and the chosen method:

  • P3P methods (@ref SOLVEPNP_P3P, @ref SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
  • @ref SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
  • @ref SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation. Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
  • point 0: [-squareLength / 2, squareLength / 2, 0]
  • point 1: [ squareLength / 2, squareLength / 2, 0]
  • point 2: [ squareLength / 2, -squareLength / 2, 0]
  • point 3: [-squareLength / 2, -squareLength / 2, 0]
  • for all the other flags, number of input points must be >= 4 and object points can be in any configuration. Only 1 solution is returned. 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d> can be also passed here. where N is the number of points. vector\<Point2d> can be also passed here. \f$\distcoeffs\f$. If the vector is NULL/empty, the zero distortion coefficients are assumed. the model coordinate system to the camera coordinate system. the provided rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further optimizes them. and useExtrinsicGuess is set to true. and useExtrinsicGuess is set to true. (\f$ \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} \f$) between the input image points and the 3D object points projected with the estimated pose. More information is described in @ref calib3d_solvePnP Note:
  • An example of how to use solvePnP for planar augmented reality can be found at opencv_source_code/samples/python/plane_ar.py
  • If you are using Python:
  • Numpy array slices won't work as input because solvePnP requires contiguous arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  • The P3P algorithm requires image points to be in an array of shape (N,1,2) due to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9) which requires 2-channel information.
  • Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints = np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  • The methods @ref SOLVEPNP_DLS and @ref SOLVEPNP_UPNP cannot be used as the current implementations are unstable and sometimes give completely wrong results. If you pass one of these two flags, @ref SOLVEPNP_EPNP method will be used instead.
  • The minimum number of points is 4 in the general case. In the case of @ref SOLVEPNP_P3P and @ref SOLVEPNP_AP3P methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  • With @ref SOLVEPNP_ITERATIVE method and useExtrinsicGuess=true, the minimum number of points is 3 (3 points are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the global solution to converge.
  • With @ref SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  • With @ref SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation. Number of input points must be 4. Object points must be defined in the following order:
  • point 0: [-squareLength / 2, squareLength / 2, 0]
  • point 1: [ squareLength / 2, squareLength / 2, 0]
  • point 2: [ squareLength / 2, -squareLength / 2, 0]
  • point 3: [-squareLength / 2, -squareLength / 2, 0]

Python prototype (for reference):

solvePnPGeneric(objectPoints, imagePoints, cameraMatrix, distCoeffs[, rvecs[, tvecs[, useExtrinsicGuess[, flags[, rvec[, tvec[, reprojectionError]]]]]]]) -> retval, rvecs, tvecs, reprojectionError
Link to this function

solvePnPGeneric(objectPoints, imagePoints, cameraMatrix, distCoeffs, opts)

View Source
Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • rvecs: vector_UMat.
  • tvecs: vector_UMat.
  • useExtrinsicGuess: bool.
  • flags: SolvePnPMethod.
  • rvec: UMat.
  • tvec: UMat.
  • reprojectionError: UMat.

Finds an object pose from 3D-2D point correspondences. @see @ref calib3d_solvePnP This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector> couple), depending on the number of input points and the chosen method:

  • P3P methods (@ref SOLVEPNP_P3P, @ref SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
  • @ref SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
  • @ref SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation. Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
  • point 0: [-squareLength / 2, squareLength / 2, 0]
  • point 1: [ squareLength / 2, squareLength / 2, 0]
  • point 2: [ squareLength / 2, -squareLength / 2, 0]
  • point 3: [-squareLength / 2, -squareLength / 2, 0]
  • for all the other flags, number of input points must be >= 4 and object points can be in any configuration. Only 1 solution is returned. 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d> can be also passed here. where N is the number of points. vector\<Point2d> can be also passed here. \f$\distcoeffs\f$. If the vector is NULL/empty, the zero distortion coefficients are assumed. the model coordinate system to the camera coordinate system. the provided rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further optimizes them. and useExtrinsicGuess is set to true. and useExtrinsicGuess is set to true. (\f$ \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} \f$) between the input image points and the 3D object points projected with the estimated pose. More information is described in @ref calib3d_solvePnP Note:
  • An example of how to use solvePnP for planar augmented reality can be found at opencv_source_code/samples/python/plane_ar.py
  • If you are using Python:
  • Numpy array slices won't work as input because solvePnP requires contiguous arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  • The P3P algorithm requires image points to be in an array of shape (N,1,2) due to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9) which requires 2-channel information.
  • Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints = np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  • The methods @ref SOLVEPNP_DLS and @ref SOLVEPNP_UPNP cannot be used as the current implementations are unstable and sometimes give completely wrong results. If you pass one of these two flags, @ref SOLVEPNP_EPNP method will be used instead.
  • The minimum number of points is 4 in the general case. In the case of @ref SOLVEPNP_P3P and @ref SOLVEPNP_AP3P methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  • With @ref SOLVEPNP_ITERATIVE method and useExtrinsicGuess=true, the minimum number of points is 3 (3 points are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the global solution to converge.
  • With @ref SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  • With @ref SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation. Number of input points must be 4. Object points must be defined in the following order:
  • point 0: [-squareLength / 2, squareLength / 2, 0]
  • point 1: [ squareLength / 2, squareLength / 2, 0]
  • point 2: [ squareLength / 2, -squareLength / 2, 0]
  • point 3: [-squareLength / 2, -squareLength / 2, 0]

Python prototype (for reference):

solvePnPGeneric(objectPoints, imagePoints, cameraMatrix, distCoeffs[, rvecs[, tvecs[, useExtrinsicGuess[, flags[, rvec[, tvec[, reprojectionError]]]]]]]) -> retval, rvecs, tvecs, reprojectionError
Link to this function

solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs)

View Source
Positional Arguments
  • objectPoints: UMat
  • imagePoints: UMat
  • cameraMatrix: UMat
  • distCoeffs: UMat
Keyword Arguments
  • rvec: UMat.
  • tvec: UMat.
  • inliers: UMat.
  • params: UsacParams.

Python prototype (for reference):

solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs[, rvec[, tvec[, inliers[, params]]]]) -> retval, cameraMatrix, rvec, tvec, inliers
Link to this function

solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, opts)

View Source
Positional Arguments
  • objectPoints: UMat
  • imagePoints: UMat
  • cameraMatrix: UMat
  • distCoeffs: UMat
Keyword Arguments
  • rvec: UMat.
  • tvec: UMat.
  • inliers: UMat.
  • params: UsacParams.

Python prototype (for reference):

solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs[, rvec[, tvec[, inliers[, params]]]]) -> retval, cameraMatrix, rvec, tvec, inliers
Link to this function

solvePnPRefineLM(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec)

View Source
Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • rvec: UMat.
  • tvec: UMat.
Keyword Arguments
  • criteria: TermCriteria.

Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution. @see @ref calib3d_solvePnP

where N is the number of points. vector\<Point3d\> can also be passed here.
where N is the number of points. vector\<Point2d\> can also be passed here.
\f$\distcoeffs\f$. If the vector is NULL/empty, the zero distortion coefficients are
assumed.
the model coordinate system to the camera coordinate system. Input values are used as an initial solution.

The function refines the object pose given at least 3 object points, their corresponding image projections, an initial solution for the rotation and translation vector, as well as the camera intrinsic matrix and the distortion coefficients. The function minimizes the projection error with respect to the rotation and the translation vectors, according to a Levenberg-Marquardt iterative minimization @cite Madsen04 @cite Eade13 process.

Python prototype (for reference):

solvePnPRefineLM(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec[, criteria]) -> rvec, tvec
Link to this function

solvePnPRefineLM(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, opts)

View Source
Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • rvec: UMat.
  • tvec: UMat.
Keyword Arguments
  • criteria: TermCriteria.

Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution. @see @ref calib3d_solvePnP

where N is the number of points. vector\<Point3d\> can also be passed here.
where N is the number of points. vector\<Point2d\> can also be passed here.
\f$\distcoeffs\f$. If the vector is NULL/empty, the zero distortion coefficients are
assumed.
the model coordinate system to the camera coordinate system. Input values are used as an initial solution.

The function refines the object pose given at least 3 object points, their corresponding image projections, an initial solution for the rotation and translation vector, as well as the camera intrinsic matrix and the distortion coefficients. The function minimizes the projection error with respect to the rotation and the translation vectors, according to a Levenberg-Marquardt iterative minimization @cite Madsen04 @cite Eade13 process.

Python prototype (for reference):

solvePnPRefineLM(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec[, criteria]) -> rvec, tvec
Link to this function

solvePnPRefineVVS(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec)

View Source
Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • rvec: UMat.
  • tvec: UMat.
Keyword Arguments
  • criteria: TermCriteria.
  • vVSlambda: double.

Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution. @see @ref calib3d_solvePnP

where N is the number of points. vector\<Point3d\> can also be passed here.
where N is the number of points. vector\<Point2d\> can also be passed here.
\f$\distcoeffs\f$. If the vector is NULL/empty, the zero distortion coefficients are
assumed.
the model coordinate system to the camera coordinate system. Input values are used as an initial solution.
gain in the Damped Gauss-Newton formulation.

The function refines the object pose given at least 3 object points, their corresponding image projections, an initial solution for the rotation and translation vector, as well as the camera intrinsic matrix and the distortion coefficients. The function minimizes the projection error with respect to the rotation and the translation vectors, using a virtual visual servoing (VVS) @cite Chaumette06 @cite Marchand16 scheme.

Python prototype (for reference):

solvePnPRefineVVS(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec[, criteria[, VVSlambda]]) -> rvec, tvec
Link to this function

solvePnPRefineVVS(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, opts)

View Source
Positional Arguments
  • objectPoints: UMat.
  • imagePoints: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
  • rvec: UMat.
  • tvec: UMat.
Keyword Arguments
  • criteria: TermCriteria.
  • vVSlambda: double.

Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution. @see @ref calib3d_solvePnP

where N is the number of points. vector\<Point3d\> can also be passed here.
where N is the number of points. vector\<Point2d\> can also be passed here.
\f$\distcoeffs\f$. If the vector is NULL/empty, the zero distortion coefficients are
assumed.
the model coordinate system to the camera coordinate system. Input values are used as an initial solution.
gain in the Damped Gauss-Newton formulation.

The function refines the object pose given at least 3 object points, their corresponding image projections, an initial solution for the rotation and translation vector, as well as the camera intrinsic matrix and the distortion coefficients. The function minimizes the projection error with respect to the rotation and the translation vectors, using a virtual visual servoing (VVS) @cite Chaumette06 @cite Marchand16 scheme.

Python prototype (for reference):

solvePnPRefineVVS(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec[, criteria[, VVSlambda]]) -> rvec, tvec
Positional Arguments
  • coeffs: UMat.
Keyword Arguments
  • roots: UMat.
  • maxIters: int.

Finds the real or complex roots of a polynomial equation. The function cv::solvePoly finds real and complex roots of a polynomial equation: \f[\texttt{coeffs} [n] x^{n} + \texttt{coeffs} [n-1] x^{n-1} + ... + \texttt{coeffs} [1] x + \texttt{coeffs} [0] = 0\f]

Python prototype (for reference):

solvePoly(coeffs[, roots[, maxIters]]) -> retval, roots
Positional Arguments
  • coeffs: UMat.
Keyword Arguments
  • roots: UMat.
  • maxIters: int.

Finds the real or complex roots of a polynomial equation. The function cv::solvePoly finds real and complex roots of a polynomial equation: \f[\texttt{coeffs} [n] x^{n} + \texttt{coeffs} [n-1] x^{n-1} + ... + \texttt{coeffs} [1] x + \texttt{coeffs} [0] = 0\f]

Python prototype (for reference):

solvePoly(coeffs[, roots[, maxIters]]) -> retval, roots
Positional Arguments
  • src: UMat.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Sorts each row or each column of a matrix. The function cv::sort sorts each matrix row or each matrix column in ascending or descending order. So you should pass two operation flags to get desired behaviour. If you want to sort matrix rows or columns lexicographically, you can use STL std::sort generic function with the proper comparison predicate. @sa sortIdx, randShuffle

Python prototype (for reference):

sort(src, flags[, dst]) -> dst
Positional Arguments
  • src: UMat.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Sorts each row or each column of a matrix. The function cv::sort sorts each matrix row or each matrix column in ascending or descending order. So you should pass two operation flags to get desired behaviour. If you want to sort matrix rows or columns lexicographically, you can use STL std::sort generic function with the proper comparison predicate. @sa sortIdx, randShuffle

Python prototype (for reference):

sort(src, flags[, dst]) -> dst
Positional Arguments
  • src: UMat.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Sorts each row or each column of a matrix. The function cv::sortIdx sorts each matrix row or each matrix column in the ascending or descending order. So you should pass two operation flags to get desired behaviour. Instead of reordering the elements themselves, it stores the indices of sorted elements in the output array. For example:

Mat A = Mat::eye(3,3,CV_32F), B;
sortIdx(A, B, SORT_EVERY_ROW + SORT_ASCENDING);
// B will probably contain
// (because of equal elements in A some permutations are possible):
// [[1, 2, 0], [0, 2, 1], [0, 1, 2]]

@sa sort, randShuffle

Python prototype (for reference):

sortIdx(src, flags[, dst]) -> dst
Link to this function

sortIdx(src, flags, opts)

View Source
Positional Arguments
  • src: UMat.
  • flags: int.
Keyword Arguments
  • dst: UMat.

Sorts each row or each column of a matrix. The function cv::sortIdx sorts each matrix row or each matrix column in the ascending or descending order. So you should pass two operation flags to get desired behaviour. Instead of reordering the elements themselves, it stores the indices of sorted elements in the output array. For example:

Mat A = Mat::eye(3,3,CV_32F), B;
sortIdx(A, B, SORT_EVERY_ROW + SORT_ASCENDING);
// B will probably contain
// (because of equal elements in A some permutations are possible):
// [[1, 2, 0], [0, 2, 1], [0, 1, 2]]

@sa sort, randShuffle

Python prototype (for reference):

sortIdx(src, flags[, dst]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dx: UMat.
  • dy: UMat.
  • ksize: int.
  • borderType: int.

Calculates the first order image derivative in both x and y using a Sobel operator Equivalent to calling:

Sobel( src, dx, CV_16SC1, 1, 0, 3 );
Sobel( src, dy, CV_16SC1, 0, 1, 3 );
Only #BORDER_DEFAULT=#BORDER_REFLECT_101 and #BORDER_REPLICATE are supported.

@sa Sobel

Python prototype (for reference):

spatialGradient(src[, dx[, dy[, ksize[, borderType]]]]) -> dx, dy
Link to this function

spatialGradient(src, opts)

View Source
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dx: UMat.
  • dy: UMat.
  • ksize: int.
  • borderType: int.

Calculates the first order image derivative in both x and y using a Sobel operator Equivalent to calling:

Sobel( src, dx, CV_16SC1, 1, 0, 3 );
Sobel( src, dy, CV_16SC1, 0, 1, 3 );
Only #BORDER_DEFAULT=#BORDER_REFLECT_101 and #BORDER_REPLICATE are supported.

@sa Sobel

Python prototype (for reference):

spatialGradient(src[, dx[, dy[, ksize[, borderType]]]]) -> dx, dy
Positional Arguments
  • m: UMat.
Keyword Arguments
  • mv: vector_UMat.

Has overloading in C++

Python prototype (for reference):

split(m[, mv]) -> mv
Positional Arguments
  • m: UMat.
Keyword Arguments
  • mv: vector_UMat.

Has overloading in C++

Python prototype (for reference):

split(m[, mv]) -> mv
Link to this function

sqrBoxFilter(src, ddepth, ksize)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
  • ksize: Size.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • normalize: bool.
  • borderType: int.

Calculates the normalized sum of squares of the pixel values overlapping the filter. For every pixel \f$ (x, y) \f$ in the source image, the function calculates the sum of squares of those neighboring pixel values which overlap the filter placed over the pixel \f$ (x, y) \f$. The unnormalized square box filter can be useful in computing local image statistics such as the local variance and standard deviation around the neighborhood of a pixel.

center.

@sa boxFilter

Python prototype (for reference):

sqrBoxFilter(src, ddepth, ksize[, dst[, anchor[, normalize[, borderType]]]]) -> dst
Link to this function

sqrBoxFilter(src, ddepth, ksize, opts)

View Source
Positional Arguments
  • src: UMat.
  • ddepth: int.
  • ksize: Size.
Keyword Arguments
  • dst: UMat.
  • anchor: Point.
  • normalize: bool.
  • borderType: int.

Calculates the normalized sum of squares of the pixel values overlapping the filter. For every pixel \f$ (x, y) \f$ in the source image, the function calculates the sum of squares of those neighboring pixel values which overlap the filter placed over the pixel \f$ (x, y) \f$. The unnormalized square box filter can be useful in computing local image statistics such as the local variance and standard deviation around the neighborhood of a pixel.

center.

@sa boxFilter

Python prototype (for reference):

sqrBoxFilter(src, ddepth, ksize[, dst[, anchor[, normalize[, borderType]]]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Calculates a square root of array elements. The function cv::sqrt calculates a square root of each input array element. In case of multi-channel arrays, each channel is processed independently. The accuracy is approximately the same as of the built-in std::sqrt .

Python prototype (for reference):

sqrt(src[, dst]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Calculates a square root of array elements. The function cv::sqrt calculates a square root of each input array element. In case of multi-channel arrays, each channel is processed independently. The accuracy is approximately the same as of the built-in std::sqrt .

Python prototype (for reference):

sqrt(src[, dst]) -> dst

Python prototype (for reference):

startWindowThread() -> retval
Link to this function

stereoCalibrate(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize)

View Source
Positional Arguments
  • objectPoints: vector_UMat
  • imagePoints1: vector_UMat
  • imagePoints2: vector_UMat
  • cameraMatrix1: UMat
  • distCoeffs1: UMat
  • cameraMatrix2: UMat
  • distCoeffs2: UMat
  • imageSize: Size
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • e: UMat.
  • f: UMat.
  • flags: int.
  • criteria: TermCriteria.

Python prototype (for reference):

stereoCalibrate(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize[, R[, T[, E[, F[, flags[, criteria]]]]]]) -> retval, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F
Link to this function

stereoCalibrate(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, opts)

View Source
Positional Arguments
  • objectPoints: vector_UMat
  • imagePoints1: vector_UMat
  • imagePoints2: vector_UMat
  • cameraMatrix1: UMat
  • distCoeffs1: UMat
  • cameraMatrix2: UMat
  • distCoeffs2: UMat
  • imageSize: Size
Keyword Arguments
  • r: UMat.
  • t: UMat.
  • e: UMat.
  • f: UMat.
  • flags: int.
  • criteria: TermCriteria.

Python prototype (for reference):

stereoCalibrate(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize[, R[, T[, E[, F[, flags[, criteria]]]]]]) -> retval, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F
Link to this function

stereoCalibrateExtended(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, r, t)

View Source
Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints1: vector_UMat.
  • imagePoints2: vector_UMat.
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
  • imageSize: Size.
  • r: UMat.
  • t: UMat.
Keyword Arguments
  • e: UMat.
  • f: UMat.
  • perViewErrors: UMat.
  • flags: int.
  • criteria: TermCriteria.

Calibrates a stereo camera set up. This function finds the intrinsic parameters for each of the two cameras and the extrinsic parameters between the two cameras.

in @ref calibrateCamera. For each pattern view, both cameras need to see the same object
points. Therefore, objectPoints.size(), imagePoints1.size(), and imagePoints2.size() need to be
equal as well as objectPoints[i].size(), imagePoints1[i].size(), and imagePoints2[i].size() need to
be equal for each i.
observed by the first camera. The same structure as in @ref calibrateCamera.
observed by the second camera. The same structure as in @ref calibrateCamera.

@ref calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below. @ref calibrateCamera.

cameraMatrix1.
description for distCoeffs1.
points given in the first camera's coordinate system to points in the second camera's
coordinate system. In more technical terms, the tuple of R and T performs a change of basis
from the first camera's coordinate system to the second camera's coordinate system. Due to its
duality, this tuple is equivalent to the position of the first camera with respect to the
second camera coordinate system.
-   @ref CALIB_FIX_INTRINSIC Fix cameraMatrix? and distCoeffs? so that only R, T, E, and F
matrices are estimated.
-   @ref CALIB_USE_INTRINSIC_GUESS Optimize some or all of the intrinsic parameters
according to the specified flags. Initial values are provided by the user.
-   @ref CALIB_USE_EXTRINSIC_GUESS R and T contain valid initial values that are optimized further.
Otherwise R and T are initialized to the median value of the pattern views (each dimension separately).
-   @ref CALIB_FIX_PRINCIPAL_POINT Fix the principal points during the optimization.
-   @ref CALIB_FIX_FOCAL_LENGTH Fix \f$f^{(j)}\_x\f$ and \f$f^{(j)}\_y\f$ .
-   @ref CALIB_FIX_ASPECT_RATIO Optimize \f$f^{(j)}\_y\f$ . Fix the ratio \f$f^{(j)}\_x/f^{(j)}\_y\f$
.
-   @ref CALIB_SAME_FOCAL_LENGTH Enforce \f$f^{(0)}\_x=f^{(1)}\_x\f$ and \f$f^{(0)}\_y=f^{(1)}\_y\f$ .
-   @ref CALIB_ZERO_TANGENT_DIST Set tangential distortion coefficients for each camera to
zeros and fix there.
-   @ref CALIB_FIX_K1,..., @ref CALIB_FIX_K6 Do not change the corresponding radial
distortion coefficient during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set,
the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
-   @ref CALIB_RATIONAL_MODEL Enable coefficients k4, k5, and k6. To provide the backward
compatibility, this extra flag should be explicitly specified to make the calibration
function use the rational model and return 8 coefficients. If the flag is not set, the
function computes and returns only 5 distortion coefficients.
-   @ref CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
backward compatibility, this extra flag should be explicitly specified to make the
calibration function use the thin prism model and return 12 coefficients. If the flag is not
set, the function computes and returns only 5 distortion coefficients.
-   @ref CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
supplied distCoeffs matrix is used. Otherwise, it is set to 0.
-   @ref CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
backward compatibility, this extra flag should be explicitly specified to make the
calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
set, the function computes and returns only 5 distortion coefficients.
-   @ref CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
supplied distCoeffs matrix is used. Otherwise, it is set to 0.

The function estimates the transformation between two cameras making a stereo pair. If one computes the poses of an object relative to the first camera and to the second camera, ( \f$R_1\f$,\f$T_1\f$ ) and (\f$R_2\f$,\f$T_2\f$), respectively, for a stereo camera where the relative position and orientation between the two cameras are fixed, then those poses definitely relate to each other. This means, if the relative position and orientation (\f$R\f$,\f$T\f$) of the two cameras is known, it is possible to compute (\f$R_2\f$,\f$T_2\f$) when (\f$R_1\f$,\f$T_1\f$) is given. This is what the described function does. It computes (\f$R\f$,\f$T\f$) such that: \f[R_2=R R_1\f] \f[T_2=R T_1 + T.\f] Therefore, one can compute the coordinate representation of a 3D point for the second camera's coordinate system when given the point's coordinate representation in the first camera's coordinate system: \f[\begin{bmatrix} X_2 \\ Y_2 \\ Z_2 \\ 1 \end{bmatrix} = \begin{bmatrix} R & T \\ 0 & 1 \end{bmatrix} \begin{bmatrix} X_1 \\ Y_1 \\ Z_1 \\ 1 \end{bmatrix}.\f] Optionally, it computes the essential matrix E: \f[E= \vecthreethree{0}{-T_2}{T_1}{T_2}{0}{-T_0}{-T_1}{T_0}{0} R\f] where \f$T_i\f$ are components of the translation vector \f$T\f$ : \f$T=[T_0, T_1, T_2]^T\f$ . And the function can also compute the fundamental matrix F: \f[F = cameraMatrix2^{-T}\cdot E \cdot cameraMatrix1^{-1}\f] Besides the stereo-related information, the function can also perform a full calibration of each of the two cameras. However, due to the high dimensionality of the parameter space and noise in the input data, the function can diverge from the correct solution. If the intrinsic parameters can be estimated with high accuracy for each of the cameras individually (for example, using #calibrateCamera ), you are recommended to do so and then pass @ref CALIB_FIX_INTRINSIC flag to the function along with the computed intrinsic parameters. Otherwise, if all the parameters are estimated at once, it makes sense to restrict some parameters, for example, pass @ref CALIB_SAME_FOCAL_LENGTH and @ref CALIB_ZERO_TANGENT_DIST flags, which is usually a reasonable assumption. Similarly to #calibrateCamera, the function minimizes the total re-projection error for all the points in all the available views from both cameras. The function returns the final value of the re-projection error.

Python prototype (for reference):

stereoCalibrateExtended(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T[, E[, F[, perViewErrors[, flags[, criteria]]]]]) -> retval, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F, perViewErrors
Link to this function

stereoCalibrateExtended(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, r, t, opts)

View Source
Positional Arguments
  • objectPoints: vector_UMat.
  • imagePoints1: vector_UMat.
  • imagePoints2: vector_UMat.
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
  • imageSize: Size.
  • r: UMat.
  • t: UMat.
Keyword Arguments
  • e: UMat.
  • f: UMat.
  • perViewErrors: UMat.
  • flags: int.
  • criteria: TermCriteria.

Calibrates a stereo camera set up. This function finds the intrinsic parameters for each of the two cameras and the extrinsic parameters between the two cameras.

in @ref calibrateCamera. For each pattern view, both cameras need to see the same object
points. Therefore, objectPoints.size(), imagePoints1.size(), and imagePoints2.size() need to be
equal as well as objectPoints[i].size(), imagePoints1[i].size(), and imagePoints2[i].size() need to
be equal for each i.
observed by the first camera. The same structure as in @ref calibrateCamera.
observed by the second camera. The same structure as in @ref calibrateCamera.

@ref calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below. @ref calibrateCamera.

cameraMatrix1.
description for distCoeffs1.
points given in the first camera's coordinate system to points in the second camera's
coordinate system. In more technical terms, the tuple of R and T performs a change of basis
from the first camera's coordinate system to the second camera's coordinate system. Due to its
duality, this tuple is equivalent to the position of the first camera with respect to the
second camera coordinate system.
-   @ref CALIB_FIX_INTRINSIC Fix cameraMatrix? and distCoeffs? so that only R, T, E, and F
matrices are estimated.
-   @ref CALIB_USE_INTRINSIC_GUESS Optimize some or all of the intrinsic parameters
according to the specified flags. Initial values are provided by the user.
-   @ref CALIB_USE_EXTRINSIC_GUESS R and T contain valid initial values that are optimized further.
Otherwise R and T are initialized to the median value of the pattern views (each dimension separately).
-   @ref CALIB_FIX_PRINCIPAL_POINT Fix the principal points during the optimization.
-   @ref CALIB_FIX_FOCAL_LENGTH Fix \f$f^{(j)}\_x\f$ and \f$f^{(j)}\_y\f$ .
-   @ref CALIB_FIX_ASPECT_RATIO Optimize \f$f^{(j)}\_y\f$ . Fix the ratio \f$f^{(j)}\_x/f^{(j)}\_y\f$
.
-   @ref CALIB_SAME_FOCAL_LENGTH Enforce \f$f^{(0)}\_x=f^{(1)}\_x\f$ and \f$f^{(0)}\_y=f^{(1)}\_y\f$ .
-   @ref CALIB_ZERO_TANGENT_DIST Set tangential distortion coefficients for each camera to
zeros and fix there.
-   @ref CALIB_FIX_K1,..., @ref CALIB_FIX_K6 Do not change the corresponding radial
distortion coefficient during the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set,
the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
-   @ref CALIB_RATIONAL_MODEL Enable coefficients k4, k5, and k6. To provide the backward
compatibility, this extra flag should be explicitly specified to make the calibration
function use the rational model and return 8 coefficients. If the flag is not set, the
function computes and returns only 5 distortion coefficients.
-   @ref CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
backward compatibility, this extra flag should be explicitly specified to make the
calibration function use the thin prism model and return 12 coefficients. If the flag is not
set, the function computes and returns only 5 distortion coefficients.
-   @ref CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
supplied distCoeffs matrix is used. Otherwise, it is set to 0.
-   @ref CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
backward compatibility, this extra flag should be explicitly specified to make the
calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
set, the function computes and returns only 5 distortion coefficients.
-   @ref CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
the optimization. If @ref CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
supplied distCoeffs matrix is used. Otherwise, it is set to 0.

The function estimates the transformation between two cameras making a stereo pair. If one computes the poses of an object relative to the first camera and to the second camera, ( \f$R_1\f$,\f$T_1\f$ ) and (\f$R_2\f$,\f$T_2\f$), respectively, for a stereo camera where the relative position and orientation between the two cameras are fixed, then those poses definitely relate to each other. This means, if the relative position and orientation (\f$R\f$,\f$T\f$) of the two cameras is known, it is possible to compute (\f$R_2\f$,\f$T_2\f$) when (\f$R_1\f$,\f$T_1\f$) is given. This is what the described function does. It computes (\f$R\f$,\f$T\f$) such that: \f[R_2=R R_1\f] \f[T_2=R T_1 + T.\f] Therefore, one can compute the coordinate representation of a 3D point for the second camera's coordinate system when given the point's coordinate representation in the first camera's coordinate system: \f[\begin{bmatrix} X_2 \\ Y_2 \\ Z_2 \\ 1 \end{bmatrix} = \begin{bmatrix} R & T \\ 0 & 1 \end{bmatrix} \begin{bmatrix} X_1 \\ Y_1 \\ Z_1 \\ 1 \end{bmatrix}.\f] Optionally, it computes the essential matrix E: \f[E= \vecthreethree{0}{-T_2}{T_1}{T_2}{0}{-T_0}{-T_1}{T_0}{0} R\f] where \f$T_i\f$ are components of the translation vector \f$T\f$ : \f$T=[T_0, T_1, T_2]^T\f$ . And the function can also compute the fundamental matrix F: \f[F = cameraMatrix2^{-T}\cdot E \cdot cameraMatrix1^{-1}\f] Besides the stereo-related information, the function can also perform a full calibration of each of the two cameras. However, due to the high dimensionality of the parameter space and noise in the input data, the function can diverge from the correct solution. If the intrinsic parameters can be estimated with high accuracy for each of the cameras individually (for example, using #calibrateCamera ), you are recommended to do so and then pass @ref CALIB_FIX_INTRINSIC flag to the function along with the computed intrinsic parameters. Otherwise, if all the parameters are estimated at once, it makes sense to restrict some parameters, for example, pass @ref CALIB_SAME_FOCAL_LENGTH and @ref CALIB_ZERO_TANGENT_DIST flags, which is usually a reasonable assumption. Similarly to #calibrateCamera, the function minimizes the total re-projection error for all the points in all the available views from both cameras. The function returns the final value of the re-projection error.

Python prototype (for reference):

stereoCalibrateExtended(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T[, E[, F[, perViewErrors[, flags[, criteria]]]]]) -> retval, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F, perViewErrors
Link to this function

stereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, r, t)

View Source
Positional Arguments
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
  • imageSize: Size.
  • r: UMat.
  • t: UMat.
Keyword Arguments
  • r1: UMat.
  • r2: UMat.
  • p1: UMat.
  • p2: UMat.
  • q: UMat.
  • flags: int.
  • alpha: double.
  • newImageSize: Size.

Computes rectification transforms for each head of a calibrated stereo camera.

see @ref stereoCalibrate.
see @ref stereoCalibrate.
brings points given in the unrectified first camera's coordinate system to points in the rectified
first camera's coordinate system. In more technical terms, it performs a change of basis from the
unrectified first camera's coordinate system to the rectified first camera's coordinate system.
brings points given in the unrectified second camera's coordinate system to points in the rectified
second camera's coordinate system. In more technical terms, it performs a change of basis from the
unrectified second camera's coordinate system to the rectified second camera's coordinate system.
camera, i.e. it projects points given in the rectified first camera coordinate system into the
rectified first camera's image.
camera, i.e. it projects points given in the rectified first camera coordinate system into the
rectified second camera's image.
the function makes the principal points of each camera have the same pixel coordinates in the
rectified views. And if the flag is not set, the function may still shift the images in the
horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
useful image area.
scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
images are zoomed and shifted so that only valid pixels are visible (no black areas after
rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
pixels from the original images from the cameras are retained in the rectified images (no source
image pixels are lost). Any intermediate value yields an intermediate result between
those two extreme cases.
#initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
preserve details in the original image, especially when there is a big radial distortion.
are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
(see the picture below).
are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
(see the picture below).

The function computes the rotation matrices for each camera that (virtually) make both camera image planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies the dense stereo correspondence problem. The function takes the matrices computed by #stereoCalibrate as input. As output, it provides two rotation matrices and also two projection matrices in the new coordinates. The function distinguishes the following two cases:

  • Horizontal stereo: the first and the second camera views are shifted relative to each other mainly along the x-axis (with possible small vertical shift). In the rectified images, the corresponding epipolar lines in the left and right cameras are horizontal and have the same y-coordinate. P1 and P2 look like: \f[\texttt{P1} = \begin{bmatrix} f & 0 & cx_1 & 0 \\ 0 & f & cy & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}\f] \f[\texttt{P2} = \begin{bmatrix} f & 0 & cx_2 & T_x*f \\ 0 & f & cy & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix} ,\f] where \f$T_x\f$ is a horizontal shift between the cameras and \f$cx_1=cx_2\f$ if @ref CALIB_ZERO_DISPARITY is set.
  • Vertical stereo: the first and the second camera views are shifted relative to each other mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like: \f[\texttt{P1} = \begin{bmatrix} f & 0 & cx & 0 \\ 0 & f & cy_1 & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}\f] \f[\texttt{P2} = \begin{bmatrix} f & 0 & cx & 0 \\ 0 & f & cy_2 & T_y*f \\ 0 & 0 & 1 & 0 \end{bmatrix},\f] where \f$T_y\f$ is a vertical shift between the cameras and \f$cy_1=cy_2\f$ if @ref CALIB_ZERO_DISPARITY is set. As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera matrices. The matrices, together with R1 and R2 , can then be passed to #initUndistortRectifyMap to initialize the rectification map for each camera. See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through the corresponding image regions. This means that the images are well rectified, which is what most stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that their interiors are all valid pixels. image

Python prototype (for reference):

stereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T[, R1[, R2[, P1[, P2[, Q[, flags[, alpha[, newImageSize]]]]]]]]) -> R1, R2, P1, P2, Q, validPixROI1, validPixROI2
Link to this function

stereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, r, t, opts)

View Source
Positional Arguments
  • cameraMatrix1: UMat.
  • distCoeffs1: UMat.
  • cameraMatrix2: UMat.
  • distCoeffs2: UMat.
  • imageSize: Size.
  • r: UMat.
  • t: UMat.
Keyword Arguments
  • r1: UMat.
  • r2: UMat.
  • p1: UMat.
  • p2: UMat.
  • q: UMat.
  • flags: int.
  • alpha: double.
  • newImageSize: Size.

Computes rectification transforms for each head of a calibrated stereo camera.

see @ref stereoCalibrate.
see @ref stereoCalibrate.
brings points given in the unrectified first camera's coordinate system to points in the rectified
first camera's coordinate system. In more technical terms, it performs a change of basis from the
unrectified first camera's coordinate system to the rectified first camera's coordinate system.
brings points given in the unrectified second camera's coordinate system to points in the rectified
second camera's coordinate system. In more technical terms, it performs a change of basis from the
unrectified second camera's coordinate system to the rectified second camera's coordinate system.
camera, i.e. it projects points given in the rectified first camera coordinate system into the
rectified first camera's image.
camera, i.e. it projects points given in the rectified first camera coordinate system into the
rectified second camera's image.
the function makes the principal points of each camera have the same pixel coordinates in the
rectified views. And if the flag is not set, the function may still shift the images in the
horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
useful image area.
scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
images are zoomed and shifted so that only valid pixels are visible (no black areas after
rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
pixels from the original images from the cameras are retained in the rectified images (no source
image pixels are lost). Any intermediate value yields an intermediate result between
those two extreme cases.
#initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
preserve details in the original image, especially when there is a big radial distortion.
are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
(see the picture below).
are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
(see the picture below).

The function computes the rotation matrices for each camera that (virtually) make both camera image planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies the dense stereo correspondence problem. The function takes the matrices computed by #stereoCalibrate as input. As output, it provides two rotation matrices and also two projection matrices in the new coordinates. The function distinguishes the following two cases:

  • Horizontal stereo: the first and the second camera views are shifted relative to each other mainly along the x-axis (with possible small vertical shift). In the rectified images, the corresponding epipolar lines in the left and right cameras are horizontal and have the same y-coordinate. P1 and P2 look like: \f[\texttt{P1} = \begin{bmatrix} f & 0 & cx_1 & 0 \\ 0 & f & cy & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}\f] \f[\texttt{P2} = \begin{bmatrix} f & 0 & cx_2 & T_x*f \\ 0 & f & cy & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix} ,\f] where \f$T_x\f$ is a horizontal shift between the cameras and \f$cx_1=cx_2\f$ if @ref CALIB_ZERO_DISPARITY is set.
  • Vertical stereo: the first and the second camera views are shifted relative to each other mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like: \f[\texttt{P1} = \begin{bmatrix} f & 0 & cx & 0 \\ 0 & f & cy_1 & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}\f] \f[\texttt{P2} = \begin{bmatrix} f & 0 & cx & 0 \\ 0 & f & cy_2 & T_y*f \\ 0 & 0 & 1 & 0 \end{bmatrix},\f] where \f$T_y\f$ is a vertical shift between the cameras and \f$cy_1=cy_2\f$ if @ref CALIB_ZERO_DISPARITY is set. As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera matrices. The matrices, together with R1 and R2 , can then be passed to #initUndistortRectifyMap to initialize the rectification map for each camera. See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through the corresponding image regions. This means that the images are well rectified, which is what most stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that their interiors are all valid pixels. image

Python prototype (for reference):

stereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T[, R1[, R2[, P1[, P2[, Q[, flags[, alpha[, newImageSize]]]]]]]]) -> R1, R2, P1, P2, Q, validPixROI1, validPixROI2
Link to this function

stereoRectifyUncalibrated(points1, points2, f, imgSize)

View Source
Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • f: UMat.
  • imgSize: Size.
Keyword Arguments
  • h1: UMat.
  • h2: UMat.
  • threshold: double.

Computes a rectification transform for an uncalibrated stereo camera.

#findFundamentalMat are supported.
#findFundamentalMat .
than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points
for which \f$|\texttt{points2\[i]}^T\*\texttt{F}\*\texttt{points1\[i]}|>\texttt{threshold}\f$ ) are
rejected prior to computing the homographies. Otherwise, all the points are considered inliers.

The function computes the rectification transformations without knowing intrinsic parameters of the cameras and their relative position in the space, which explains the suffix "uncalibrated". Another related difference from #stereoRectify is that the function outputs not the rectification transformations in the object (3D) space, but the planar perspective transformations encoded by the homography matrices H1 and H2 . The function implements the algorithm @cite Hartley99 . Note: While the algorithm does not need to know the intrinsic parameters of the cameras, it heavily depends on the epipolar geometry. Therefore, if the camera lenses have a significant distortion, it would be better to correct it before computing the fundamental matrix and calling this function. For example, distortion coefficients can be estimated for each head of stereo camera separately by using #calibrateCamera . Then, the images can be corrected using #undistort , or just the point coordinates can be corrected with #undistortPoints .

Python prototype (for reference):

stereoRectifyUncalibrated(points1, points2, F, imgSize[, H1[, H2[, threshold]]]) -> retval, H1, H2
Link to this function

stereoRectifyUncalibrated(points1, points2, f, imgSize, opts)

View Source
Positional Arguments
  • points1: UMat.
  • points2: UMat.
  • f: UMat.
  • imgSize: Size.
Keyword Arguments
  • h1: UMat.
  • h2: UMat.
  • threshold: double.

Computes a rectification transform for an uncalibrated stereo camera.

#findFundamentalMat are supported.
#findFundamentalMat .
than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points
for which \f$|\texttt{points2\[i]}^T\*\texttt{F}\*\texttt{points1\[i]}|>\texttt{threshold}\f$ ) are
rejected prior to computing the homographies. Otherwise, all the points are considered inliers.

The function computes the rectification transformations without knowing intrinsic parameters of the cameras and their relative position in the space, which explains the suffix "uncalibrated". Another related difference from #stereoRectify is that the function outputs not the rectification transformations in the object (3D) space, but the planar perspective transformations encoded by the homography matrices H1 and H2 . The function implements the algorithm @cite Hartley99 . Note: While the algorithm does not need to know the intrinsic parameters of the cameras, it heavily depends on the epipolar geometry. Therefore, if the camera lenses have a significant distortion, it would be better to correct it before computing the fundamental matrix and calling this function. For example, distortion coefficients can be estimated for each head of stereo camera separately by using #calibrateCamera . Then, the images can be corrected using #undistort , or just the point coordinates can be corrected with #undistortPoints .

Python prototype (for reference):

stereoRectifyUncalibrated(points1, points2, F, imgSize[, H1[, H2[, threshold]]]) -> retval, H1, H2
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • sigma_s: float.
  • sigma_r: float.

Stylization aims to produce digital imagery with a wide variety of effects not focused on photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low contrast while preserving, or enhancing, high-contrast features.

Python prototype (for reference):

stylization(src[, dst[, sigma_s[, sigma_r]]]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.
  • sigma_s: float.
  • sigma_r: float.

Stylization aims to produce digital imagery with a wide variety of effects not focused on photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low contrast while preserving, or enhancing, high-contrast features.

Python prototype (for reference):

stylization(src[, dst[, sigma_s[, sigma_r]]]) -> dst
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • mask: UMat.
  • dtype: int.

Calculates the per-element difference between two arrays or array and a scalar. The function subtract calculates:

  • Difference between two arrays, when both input arrays have the same size and the same number of channels: \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) - \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\f]
  • Difference between an array and a scalar, when src2 is constructed from Scalar or has the same number of elements as src1.channels(): \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) - \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\f]
  • Difference between a scalar and an array, when src1 is constructed from Scalar or has the same number of elements as src2.channels(): \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} - \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\f]
  • The reverse difference between a scalar and an array in the case of SubRS: \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src2} - \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0\f] where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. The first function in the list above can be replaced with matrix expressions:
    dst = src1 - src2;
    dst -= src1; // equivalent to subtract(dst, src1, dst);
    The input arrays and the output array can all have the same or different depths. For example, you can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of the output array is determined by dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case the output array will have the same depth as the input array, be it src1, src2 or both. Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow. of the output array to be changed. @sa add, addWeighted, scaleAdd, Mat::convertTo

Python prototype (for reference):

subtract(src1, src2[, dst[, mask[, dtype]]]) -> dst
Link to this function

subtract(src1, src2, opts)

View Source
Positional Arguments
  • src1: UMat.
  • src2: UMat.
Keyword Arguments
  • dst: UMat.
  • mask: UMat.
  • dtype: int.

Calculates the per-element difference between two arrays or array and a scalar. The function subtract calculates:

  • Difference between two arrays, when both input arrays have the same size and the same number of channels: \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) - \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\f]
  • Difference between an array and a scalar, when src2 is constructed from Scalar or has the same number of elements as src1.channels(): \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1}(I) - \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\f]
  • Difference between a scalar and an array, when src1 is constructed from Scalar or has the same number of elements as src2.channels(): \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src1} - \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\f]
  • The reverse difference between a scalar and an array in the case of SubRS: \f[\texttt{dst}(I) = \texttt{saturate} ( \texttt{src2} - \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0\f] where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. The first function in the list above can be replaced with matrix expressions:
    dst = src1 - src2;
    dst -= src1; // equivalent to subtract(dst, src1, dst);
    The input arrays and the output array can all have the same or different depths. For example, you can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of the output array is determined by dtype parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this case the output array will have the same depth as the input array, be it src1, src2 or both. Note: Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow. of the output array to be changed. @sa add, addWeighted, scaleAdd, Mat::convertTo

Python prototype (for reference):

subtract(src1, src2[, dst[, mask[, dtype]]]) -> dst

Calculates the sum of array elements. The function cv::sum calculates and returns the sum of array elements, independently for each channel. @sa countNonZero, mean, meanStdDev, norm, minMaxLoc, reduce

Python prototype (for reference):

sumElems(src) -> retval
Link to this function

svBackSubst(w, u, vt, rhs)

View Source
Positional Arguments
  • w: UMat
  • u: UMat
  • vt: UMat
  • rhs: UMat
Keyword Arguments
  • dst: UMat.

    wrap SVD::backSubst

Python prototype (for reference):

SVBackSubst(w, u, vt, rhs[, dst]) -> dst
Link to this function

svBackSubst(w, u, vt, rhs, opts)

View Source
Positional Arguments
  • w: UMat
  • u: UMat
  • vt: UMat
  • rhs: UMat
Keyword Arguments
  • dst: UMat.

    wrap SVD::backSubst

Python prototype (for reference):

SVBackSubst(w, u, vt, rhs[, dst]) -> dst
Positional Arguments
  • src: UMat
Keyword Arguments
  • w: UMat.

  • u: UMat.

  • vt: UMat.

  • flags: int.

    wrap SVD::compute

Python prototype (for reference):

SVDecomp(src[, w[, u[, vt[, flags]]]]) -> w, u, vt
Positional Arguments
  • src: UMat
Keyword Arguments
  • w: UMat.

  • u: UMat.

  • vt: UMat.

  • flags: int.

    wrap SVD::compute

Python prototype (for reference):

SVDecomp(src[, w[, u[, vt[, flags]]]]) -> w, u, vt
Link to this function

textureFlattening(src, mask)

View Source
Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.
  • low_threshold: float.
  • high_threshold: float.
  • kernel_size: int.

By retaining only the gradients at edge locations, before integrating with the Poisson solver, one washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge %Detector is used. Note: The algorithm assumes that the color of the source image is close to that of the destination. This assumption means that when the colors don't match, the source image color gets tinted toward the color of the destination image.

Python prototype (for reference):

textureFlattening(src, mask[, dst[, low_threshold[, high_threshold[, kernel_size]]]]) -> dst
Link to this function

textureFlattening(src, mask, opts)

View Source
Positional Arguments
  • src: UMat.
  • mask: UMat.
Keyword Arguments
  • dst: UMat.
  • low_threshold: float.
  • high_threshold: float.
  • kernel_size: int.

By retaining only the gradients at edge locations, before integrating with the Poisson solver, one washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge %Detector is used. Note: The algorithm assumes that the color of the source image is close to that of the destination. This assumption means that when the colors don't match, the source image color gets tinted toward the color of the destination image.

Python prototype (for reference):

textureFlattening(src, mask[, dst[, low_threshold[, high_threshold[, kernel_size]]]]) -> dst
Link to this function

threshold(src, thresh, maxval, type)

View Source
Positional Arguments
  • src: UMat.
  • thresh: double.
  • maxval: double.
  • type: int.
Keyword Arguments
  • dst: UMat.

Applies a fixed-level threshold to each array element. The function applies fixed-level thresholding to a multiple-channel array. The function is typically used to get a bi-level (binary) image out of a grayscale image ( #compare could be also used for this purpose) or for removing a noise, that is, filtering out pixels with too small or too large values. There are several types of thresholding supported by the function. They are determined by type parameter. Also, the special values #THRESH_OTSU or #THRESH_TRIANGLE may be combined with one of the above values. In these cases, the function determines the optimal threshold value using the Otsu's or Triangle algorithm and uses it instead of the specified thresh. Note: Currently, the Otsu's and Triangle methods are implemented only for 8-bit single-channel images.

types.

@return the computed threshold value if Otsu's or Triangle methods used. @sa adaptiveThreshold, findContours, compare, min, max

Python prototype (for reference):

threshold(src, thresh, maxval, type[, dst]) -> retval, dst
Link to this function

threshold(src, thresh, maxval, type, opts)

View Source
Positional Arguments
  • src: UMat.
  • thresh: double.
  • maxval: double.
  • type: int.
Keyword Arguments
  • dst: UMat.

Applies a fixed-level threshold to each array element. The function applies fixed-level thresholding to a multiple-channel array. The function is typically used to get a bi-level (binary) image out of a grayscale image ( #compare could be also used for this purpose) or for removing a noise, that is, filtering out pixels with too small or too large values. There are several types of thresholding supported by the function. They are determined by type parameter. Also, the special values #THRESH_OTSU or #THRESH_TRIANGLE may be combined with one of the above values. In these cases, the function determines the optimal threshold value using the Otsu's or Triangle algorithm and uses it instead of the specified thresh. Note: Currently, the Otsu's and Triangle methods are implemented only for 8-bit single-channel images.

types.

@return the computed threshold value if Otsu's or Triangle methods used. @sa adaptiveThreshold, findContours, compare, min, max

Python prototype (for reference):

threshold(src, thresh, maxval, type[, dst]) -> retval, dst

Returns the trace of a matrix. The function cv::trace returns the sum of the diagonal elements of the matrix mtx . \f[\mathrm{tr} ( \texttt{mtx} ) = \sum _i \texttt{mtx} (i,i)\f]

Python prototype (for reference):

trace(mtx) -> retval
Positional Arguments
  • src: UMat.
  • m: UMat.
Keyword Arguments
  • dst: UMat.

Performs the matrix transformation of every array element. The function cv::transform performs the matrix transformation of every element of the array src and stores the results in dst : \f[\texttt{dst} (I) = \texttt{m} \cdot \texttt{src} (I)\f] (when m.cols=src.channels() ), or \f[\texttt{dst} (I) = \texttt{m} \cdot [ \texttt{src} (I); 1]\f] (when m.cols=src.channels()+1 ) Every element of the N -channel array src is interpreted as N -element vector that is transformed using the M x N or M x (N+1) matrix m to M-element vector - the corresponding element of the output array dst . The function may be used for geometrical transformation of N -dimensional points, arbitrary linear color space transformation (such as various kinds of RGB to YUV transforms), shuffling the image channels, and so forth.

m.cols or m.cols-1.
many channels as m.rows.

@sa perspectiveTransform, getAffineTransform, estimateAffine2D, warpAffine, warpPerspective

Python prototype (for reference):

transform(src, m[, dst]) -> dst
Positional Arguments
  • src: UMat.
  • m: UMat.
Keyword Arguments
  • dst: UMat.

Performs the matrix transformation of every array element. The function cv::transform performs the matrix transformation of every element of the array src and stores the results in dst : \f[\texttt{dst} (I) = \texttt{m} \cdot \texttt{src} (I)\f] (when m.cols=src.channels() ), or \f[\texttt{dst} (I) = \texttt{m} \cdot [ \texttt{src} (I); 1]\f] (when m.cols=src.channels()+1 ) Every element of the N -channel array src is interpreted as N -element vector that is transformed using the M x N or M x (N+1) matrix m to M-element vector - the corresponding element of the output array dst . The function may be used for geometrical transformation of N -dimensional points, arbitrary linear color space transformation (such as various kinds of RGB to YUV transforms), shuffling the image channels, and so forth.

m.cols or m.cols-1.
many channels as m.rows.

@sa perspectiveTransform, getAffineTransform, estimateAffine2D, warpAffine, warpPerspective

Python prototype (for reference):

transform(src, m[, dst]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Transposes a matrix. The function cv::transpose transposes the matrix src : \f[\texttt{dst} (i,j) = \texttt{src} (j,i)\f] Note: No complex conjugation is done in case of a complex matrix. It should be done separately if needed.

Python prototype (for reference):

transpose(src[, dst]) -> dst
Positional Arguments
  • src: UMat.
Keyword Arguments
  • dst: UMat.

Transposes a matrix. The function cv::transpose transposes the matrix src : \f[\texttt{dst} (i,j) = \texttt{src} (j,i)\f] Note: No complex conjugation is done in case of a complex matrix. It should be done separately if needed.

Python prototype (for reference):

transpose(src[, dst]) -> dst
Positional Arguments
  • src: UMat.
  • order: vector_int.
Keyword Arguments
  • dst: UMat.

Transpose for n-dimensional matrices. Note: Input should be continuous single-channel matrix.

 The ith axis of dst will correspond to the axis numbered order[i] of the input.

Python prototype (for reference):

transposeND(src, order[, dst]) -> dst
Link to this function

transposeND(src, order, opts)

View Source
Positional Arguments
  • src: UMat.
  • order: vector_int.
Keyword Arguments
  • dst: UMat.

Transpose for n-dimensional matrices. Note: Input should be continuous single-channel matrix.

 The ith axis of dst will correspond to the axis numbered order[i] of the input.

Python prototype (for reference):

transposeND(src, order[, dst]) -> dst
Link to this function

triangulatePoints(projMatr1, projMatr2, projPoints1, projPoints2)

View Source
Positional Arguments
  • projMatr1: UMat.
  • projMatr2: UMat.
  • projPoints1: UMat.
  • projPoints2: UMat.
Keyword Arguments
  • points4D: UMat.

This function reconstructs 3-dimensional points (in homogeneous coordinates) by using their observations with a stereo camera.

given in the world's coordinate system into the first image.
given in the world's coordinate system into the second image.
it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.
version, it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.
returned in the world's coordinate system.

Note: Keep in mind that all input data should be of float type in order for this function to work. Note: If the projection matrices from @ref stereoRectify are used, then the returned points are represented in the first camera's rectified coordinate system. @sa reprojectImageTo3D

Python prototype (for reference):

triangulatePoints(projMatr1, projMatr2, projPoints1, projPoints2[, points4D]) -> points4D
Link to this function

triangulatePoints(projMatr1, projMatr2, projPoints1, projPoints2, opts)

View Source
Positional Arguments
  • projMatr1: UMat.
  • projMatr2: UMat.
  • projPoints1: UMat.
  • projPoints2: UMat.
Keyword Arguments
  • points4D: UMat.

This function reconstructs 3-dimensional points (in homogeneous coordinates) by using their observations with a stereo camera.

given in the world's coordinate system into the first image.
given in the world's coordinate system into the second image.
it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.
version, it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.
returned in the world's coordinate system.

Note: Keep in mind that all input data should be of float type in order for this function to work. Note: If the projection matrices from @ref stereoRectify are used, then the returned points are represented in the first camera's rectified coordinate system. @sa reprojectImageTo3D

Python prototype (for reference):

triangulatePoints(projMatr1, projMatr2, projPoints1, projPoints2[, points4D]) -> points4D
Link to this function

undistort(src, cameraMatrix, distCoeffs)

View Source
Positional Arguments
  • src: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • dst: UMat.
  • newCameraMatrix: UMat.

Transforms an image to compensate for lens distortion. The function transforms an image to compensate radial and tangential lens distortion. The function is simply a combination of #initUndistortRectifyMap (with unity R ) and #remap (with bilinear interpolation). See the former function for details of the transformation being performed. Those pixels in the destination image, for which there is no correspondent pixels in the source image, are filled with zeros (black color). A particular subset of the source image that will be visible in the corrected image can be regulated by newCameraMatrix. You can use #getOptimalNewCameraMatrix to compute the appropriate newCameraMatrix depending on your requirements. The camera matrix and the distortion parameters can be determined using #calibrateCamera. If the resolution of images is different from the resolution used at the calibration stage, \f$f_x, f_y, c_x\f$ and \f$c_y\f$ need to be scaled accordingly, while the distortion coefficients remain the same.

\f$(k\_1, k\_2, p\_1, p\_2\[, k\_3\[, k\_4, k\_5, k\_6\[, s\_1, s\_2, s\_3, s\_4\[, \tau\_x, \tau\_y]]]])\f$
of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
cameraMatrix but you may additionally scale and shift the result by using a different matrix.

Python prototype (for reference):

undistort(src, cameraMatrix, distCoeffs[, dst[, newCameraMatrix]]) -> dst
Link to this function

undistort(src, cameraMatrix, distCoeffs, opts)

View Source
Positional Arguments
  • src: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • dst: UMat.
  • newCameraMatrix: UMat.

Transforms an image to compensate for lens distortion. The function transforms an image to compensate radial and tangential lens distortion. The function is simply a combination of #initUndistortRectifyMap (with unity R ) and #remap (with bilinear interpolation). See the former function for details of the transformation being performed. Those pixels in the destination image, for which there is no correspondent pixels in the source image, are filled with zeros (black color). A particular subset of the source image that will be visible in the corrected image can be regulated by newCameraMatrix. You can use #getOptimalNewCameraMatrix to compute the appropriate newCameraMatrix depending on your requirements. The camera matrix and the distortion parameters can be determined using #calibrateCamera. If the resolution of images is different from the resolution used at the calibration stage, \f$f_x, f_y, c_x\f$ and \f$c_y\f$ need to be scaled accordingly, while the distortion coefficients remain the same.

\f$(k\_1, k\_2, p\_1, p\_2\[, k\_3\[, k\_4, k\_5, k\_6\[, s\_1, s\_2, s\_3, s\_4\[, \tau\_x, \tau\_y]]]])\f$
of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
cameraMatrix but you may additionally scale and shift the result by using a different matrix.

Python prototype (for reference):

undistort(src, cameraMatrix, distCoeffs[, dst[, newCameraMatrix]]) -> dst
Link to this function

undistortImagePoints(src, cameraMatrix, distCoeffs)

View Source
Positional Arguments
  • src: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • dst: UMat.
  • arg1: TermCriteria.

Compute undistorted image points position

CV_64FC2) (or vector\<Point2f\> ).

Python prototype (for reference):

undistortImagePoints(src, cameraMatrix, distCoeffs[, dst[, arg1]]) -> dst
Link to this function

undistortImagePoints(src, cameraMatrix, distCoeffs, opts)

View Source
Positional Arguments
  • src: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • dst: UMat.
  • arg1: TermCriteria.

Compute undistorted image points position

CV_64FC2) (or vector\<Point2f\> ).

Python prototype (for reference):

undistortImagePoints(src, cameraMatrix, distCoeffs[, dst[, arg1]]) -> dst
Link to this function

undistortPoints(src, cameraMatrix, distCoeffs)

View Source
Positional Arguments
  • src: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • dst: UMat.
  • r: UMat.
  • p: UMat.

Computes the ideal point coordinates from the observed point coordinates. The function is similar to #undistort and #initUndistortRectifyMap but it operates on a sparse set of points instead of a raster image. Also the function performs a reverse transformation to #projectPoints. In case of a 3D object, it does not reconstruct its 3D coordinates, but for a planar object, it does, up to a translation vector, if the proper R is specified. For each observed point coordinate \f$(u, v)\f$ the function computes: \f[ \begin{array}{l} x^{"} \leftarrow (u - c_x)/f_x \\ y^{"} \leftarrow (v - c_y)/f_y \\ (x',y') = undistort(x^{"},y^{"}, \texttt{distCoeffs}) \\ {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\ x \leftarrow X/W \\ y \leftarrow Y/W \\ \text{only performed if P is specified:} \\ u' \leftarrow x {f'}_x + {c'}_x \\ v' \leftarrow y {f'}_y + {c'}_y \end{array} \f] where undistort is an approximate iterative algorithm that estimates the normalized original point coordinates out of the normalized distorted point coordinates ("normalized" means that the coordinates do not depend on the camera matrix). The function can be used for both a stereo camera head or a monocular camera (when R is empty).

vector\<Point2f\> ).
transformation. If matrix P is identity or omitted, dst will contain normalized point coordinates.
\f$(k\_1, k\_2, p\_1, p\_2\[, k\_3\[, k\_4, k\_5, k\_6\[, s\_1, s\_2, s\_3, s\_4\[, \tau\_x, \tau\_y]]]])\f$
of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
#stereoRectify can be passed here. If the matrix is empty, the identity transformation is used.
#stereoRectify can be passed here. If the matrix is empty, the identity new camera matrix is used.

Python prototype (for reference):

undistortPoints(src, cameraMatrix, distCoeffs[, dst[, R[, P]]]) -> dst
Link to this function

undistortPoints(src, cameraMatrix, distCoeffs, opts)

View Source
Positional Arguments
  • src: UMat.
  • cameraMatrix: UMat.
  • distCoeffs: UMat.
Keyword Arguments
  • dst: UMat.
  • r: UMat.
  • p: UMat.

Computes the ideal point coordinates from the observed point coordinates. The function is similar to #undistort and #initUndistortRectifyMap but it operates on a sparse set of points instead of a raster image. Also the function performs a reverse transformation to #projectPoints. In case of a 3D object, it does not reconstruct its 3D coordinates, but for a planar object, it does, up to a translation vector, if the proper R is specified. For each observed point coordinate \f$(u, v)\f$ the function computes: \f[ \begin{array}{l} x^{"} \leftarrow (u - c_x)/f_x \\ y^{"} \leftarrow (v - c_y)/f_y \\ (x',y') = undistort(x^{"},y^{"}, \texttt{distCoeffs}) \\ {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\ x \leftarrow X/W \\ y \leftarrow Y/W \\ \text{only performed if P is specified:} \\ u' \leftarrow x {f'}_x + {c'}_x \\ v' \leftarrow y {f'}_y + {c'}_y \end{array} \f] where undistort is an approximate iterative algorithm that estimates the normalized original point coordinates out of the normalized distorted point coordinates ("normalized" means that the coordinates do not depend on the camera matrix). The function can be used for both a stereo camera head or a monocular camera (when R is empty).

vector\<Point2f\> ).
transformation. If matrix P is identity or omitted, dst will contain normalized point coordinates.
\f$(k\_1, k\_2, p\_1, p\_2\[, k\_3\[, k\_4, k\_5, k\_6\[, s\_1, s\_2, s\_3, s\_4\[, \tau\_x, \tau\_y]]]])\f$
of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
#stereoRectify can be passed here. If the matrix is empty, the identity transformation is used.
#stereoRectify can be passed here. If the matrix is empty, the identity new camera matrix is used.

Python prototype (for reference):

undistortPoints(src, cameraMatrix, distCoeffs[, dst[, R[, P]]]) -> dst
Link to this function

undistortPointsIter(src, cameraMatrix, distCoeffs, r, p, criteria)

View Source
Positional Arguments
  • src: UMat
  • cameraMatrix: UMat
  • distCoeffs: UMat
  • r: UMat
  • p: UMat
  • criteria: TermCriteria
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Note: Default version of #undistortPoints does 5 iterations to compute undistorted points.

Python prototype (for reference):

undistortPointsIter(src, cameraMatrix, distCoeffs, R, P, criteria[, dst]) -> dst
Link to this function

undistortPointsIter(src, cameraMatrix, distCoeffs, r, p, criteria, opts)

View Source
Positional Arguments
  • src: UMat
  • cameraMatrix: UMat
  • distCoeffs: UMat
  • r: UMat
  • p: UMat
  • criteria: TermCriteria
Keyword Arguments
  • dst: UMat.

Has overloading in C++

Note: Default version of #undistortPoints does 5 iterations to compute undistorted points.

Python prototype (for reference):

undistortPointsIter(src, cameraMatrix, distCoeffs, R, P, criteria[, dst]) -> dst

Python prototype (for reference):

useOpenVX() -> retval

Returns the status of optimized code usage. The function returns true if the optimized code is enabled. Otherwise, it returns false.

Python prototype (for reference):

useOptimized() -> retval
Link to this function

validateDisparity(disparity, cost, minDisparity, numberOfDisparities)

View Source
Positional Arguments
  • disparity: UMat
  • cost: UMat
  • minDisparity: int
  • numberOfDisparities: int
Keyword Arguments
  • disp12MaxDisp: int.

Python prototype (for reference):

validateDisparity(disparity, cost, minDisparity, numberOfDisparities[, disp12MaxDisp]) -> disparity
Link to this function

validateDisparity(disparity, cost, minDisparity, numberOfDisparities, opts)

View Source
Positional Arguments
  • disparity: UMat
  • cost: UMat
  • minDisparity: int
  • numberOfDisparities: int
Keyword Arguments
  • disp12MaxDisp: int.

Python prototype (for reference):

validateDisparity(disparity, cost, minDisparity, numberOfDisparities[, disp12MaxDisp]) -> disparity
Positional Arguments
  • src: vector_UMat.
Keyword Arguments
  • dst: UMat.

Has overloading in C++

std::vector<cv::Mat> matrices = { cv::Mat(1, 4, CV_8UC1, cv::Scalar(1)),
cv::Mat(1, 4, CV_8UC1, cv::Scalar(2)),
cv::Mat(1, 4, CV_8UC1, cv::Scalar(3)),};
cv::Mat out;
cv::vconcat( matrices, out );
//out:
//[1,   1,   1,   1;
// 2,   2,   2,   2;
// 3,   3,   3,   3]
same depth.

Python prototype (for reference):

vconcat(src[, dst]) -> dst
Positional Arguments
  • src: vector_UMat.
Keyword Arguments
  • dst: UMat.

Has overloading in C++

std::vector<cv::Mat> matrices = { cv::Mat(1, 4, CV_8UC1, cv::Scalar(1)),
cv::Mat(1, 4, CV_8UC1, cv::Scalar(2)),
cv::Mat(1, 4, CV_8UC1, cv::Scalar(3)),};
cv::Mat out;
cv::vconcat( matrices, out );
//out:
//[1,   1,   1,   1;
// 2,   2,   2,   2;
// 3,   3,   3,   3]
same depth.

Python prototype (for reference):

vconcat(src[, dst]) -> dst
Positional Arguments
Keyword Arguments
  • delay: int.

Similar to #waitKey, but returns full key code. Note: Key code is implementation specific and depends on used backend: QT/GTK/Win32/etc

Python prototype (for reference):

waitKeyEx([, delay]) -> retval
Positional Arguments
Keyword Arguments
  • delay: int.

Similar to #waitKey, but returns full key code. Note: Key code is implementation specific and depends on used backend: QT/GTK/Win32/etc

Python prototype (for reference):

waitKeyEx([, delay]) -> retval
Link to this function

warpAffine(src, m, dsize)

View Source
Positional Arguments
  • src: UMat.
  • m: UMat.
  • dsize: Size.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • borderMode: int.
  • borderValue: Scalar.

Applies an affine transformation to an image. The function warpAffine transforms the source image using the specified matrix: \f[\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})\f] when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with #invertAffineTransform and then put in the formula above instead of M. The function cannot operate in-place.

flag #WARP_INVERSE_MAP that means that M is the inverse transformation (
\f$\texttt{dst}\rightarrow\texttt{src}\f$ ).
borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
the "outliers" in the source image are not modified by the function.

@sa warpPerspective, resize, remap, getRectSubPix, transform

Python prototype (for reference):

warpAffine(src, M, dsize[, dst[, flags[, borderMode[, borderValue]]]]) -> dst
Link to this function

warpAffine(src, m, dsize, opts)

View Source
Positional Arguments
  • src: UMat.
  • m: UMat.
  • dsize: Size.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • borderMode: int.
  • borderValue: Scalar.

Applies an affine transformation to an image. The function warpAffine transforms the source image using the specified matrix: \f[\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})\f] when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with #invertAffineTransform and then put in the formula above instead of M. The function cannot operate in-place.

flag #WARP_INVERSE_MAP that means that M is the inverse transformation (
\f$\texttt{dst}\rightarrow\texttt{src}\f$ ).
borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
the "outliers" in the source image are not modified by the function.

@sa warpPerspective, resize, remap, getRectSubPix, transform

Python prototype (for reference):

warpAffine(src, M, dsize[, dst[, flags[, borderMode[, borderValue]]]]) -> dst
Link to this function

warpPerspective(src, m, dsize)

View Source
Positional Arguments
  • src: UMat.
  • m: UMat.
  • dsize: Size.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • borderMode: int.
  • borderValue: Scalar.

Applies a perspective transformation to an image. The function warpPerspective transforms the source image using the specified matrix: \f[\texttt{dst} (x,y) = \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} , \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\f] when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert and then put in the formula above instead of M. The function cannot operate in-place.

optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation (
\f$\texttt{dst}\rightarrow\texttt{src}\f$ ).

@sa warpAffine, resize, remap, getRectSubPix, perspectiveTransform

Python prototype (for reference):

warpPerspective(src, M, dsize[, dst[, flags[, borderMode[, borderValue]]]]) -> dst
Link to this function

warpPerspective(src, m, dsize, opts)

View Source
Positional Arguments
  • src: UMat.
  • m: UMat.
  • dsize: Size.
Keyword Arguments
  • dst: UMat.
  • flags: int.
  • borderMode: int.
  • borderValue: Scalar.

Applies a perspective transformation to an image. The function warpPerspective transforms the source image using the specified matrix: \f[\texttt{dst} (x,y) = \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} , \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\f] when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert and then put in the formula above instead of M. The function cannot operate in-place.

optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation (
\f$\texttt{dst}\rightarrow\texttt{src}\f$ ).

@sa warpAffine, resize, remap, getRectSubPix, perspectiveTransform

Python prototype (for reference):

warpPerspective(src, M, dsize[, dst[, flags[, borderMode[, borderValue]]]]) -> dst
Link to this function

warpPolar(src, dsize, center, maxRadius, flags)

View Source
Positional Arguments
  • src: UMat.
  • dsize: Size.
  • center: Point2f.
  • maxRadius: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

    \brief Remaps an image to polar or semilog-polar coordinates space

@anchor polar_remaps_reference_image Polar remaps reference Transform the source image using the following transformation: \f[ dst(\rho , \phi ) = src(x,y) \f] where \f[ \begin{array}{l} \vec{I} = (x - center.x, \;y - center.y) \\ \phi = Kangle \cdot \texttt{angle} (\vec{I}) \\ \rho = \left\{\begin{matrix} Klin \cdot \texttt{magnitude} (\vec{I}) & default \\ Klog \cdot log_e(\texttt{magnitude} (\vec{I})) & if \; semilog \\ \end{matrix}\right. \end{array} \f] and \f[ \begin{array}{l} Kangle = dsize.height / 2\Pi \\ Klin = dsize.width / maxRadius \\ Klog = dsize.width / log_e(maxRadius) \\ \end{array} \f] \par Linear vs semilog mapping Polar mapping can be linear or semi-log. Add one of #WarpPolarMode to flags to specify the polar mapping mode. Linear is the default mode. The semilog mapping emulates the human "foveal" vision that permit very high acuity on the line of sight (central vision) in contrast to peripheral vision where acuity is minor. \par Option on dsize:

  • if both values in dsize <=0 (default), the destination image will have (almost) same area of source bounding circle: \f[\begin{array}{l} dsize.area \leftarrow (maxRadius^2 \cdot \Pi) \\ dsize.width = \texttt{cvRound}(maxRadius) \\ dsize.height = \texttt{cvRound}(maxRadius \cdot \Pi) \\ \end{array}\f]
  • if only dsize.height <= 0, the destination image area will be proportional to the bounding circle area but scaled by Kx * Kx: \f[\begin{array}{l} dsize.height = \texttt{cvRound}(dsize.width \cdot \Pi) \\ \end{array} \f]
  • if both values in dsize > 0, the destination image will have the given size therefore the area of the bounding circle will be scaled to dsize. \par Reverse mapping You can get reverse mapping adding #WARP_INVERSE_MAP to flags \snippet polar_transforms.cpp InverseMap In addiction, to calculate the original coordinate from a polar mapped coordinate \f$(rho, phi)->(x, y)\f$: \snippet polar_transforms.cpp InverseCoordinate
    • Add #WARP_POLAR_LINEAR to select linear polar mapping (default)
    • Add #WARP_POLAR_LOG to select semilog polar mapping
    • Add #WARP_INVERSE_MAP for reverse mapping. Note:
  • The function can not operate in-place.
  • To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees.
  • This function uses #remap. Due to current implementation limitations the size of an input and output images should be less than 32767x32767. @sa cv::remap

Python prototype (for reference):

warpPolar(src, dsize, center, maxRadius, flags[, dst]) -> dst
Link to this function

warpPolar(src, dsize, center, maxRadius, flags, opts)

View Source
Positional Arguments
  • src: UMat.
  • dsize: Size.
  • center: Point2f.
  • maxRadius: double.
  • flags: int.
Keyword Arguments
  • dst: UMat.

    \brief Remaps an image to polar or semilog-polar coordinates space

@anchor polar_remaps_reference_image Polar remaps reference Transform the source image using the following transformation: \f[ dst(\rho , \phi ) = src(x,y) \f] where \f[ \begin{array}{l} \vec{I} = (x - center.x, \;y - center.y) \\ \phi = Kangle \cdot \texttt{angle} (\vec{I}) \\ \rho = \left\{\begin{matrix} Klin \cdot \texttt{magnitude} (\vec{I}) & default \\ Klog \cdot log_e(\texttt{magnitude} (\vec{I})) & if \; semilog \\ \end{matrix}\right. \end{array} \f] and \f[ \begin{array}{l} Kangle = dsize.height / 2\Pi \\ Klin = dsize.width / maxRadius \\ Klog = dsize.width / log_e(maxRadius) \\ \end{array} \f] \par Linear vs semilog mapping Polar mapping can be linear or semi-log. Add one of #WarpPolarMode to flags to specify the polar mapping mode. Linear is the default mode. The semilog mapping emulates the human "foveal" vision that permit very high acuity on the line of sight (central vision) in contrast to peripheral vision where acuity is minor. \par Option on dsize:

  • if both values in dsize <=0 (default), the destination image will have (almost) same area of source bounding circle: \f[\begin{array}{l} dsize.area \leftarrow (maxRadius^2 \cdot \Pi) \\ dsize.width = \texttt{cvRound}(maxRadius) \\ dsize.height = \texttt{cvRound}(maxRadius \cdot \Pi) \\ \end{array}\f]
  • if only dsize.height <= 0, the destination image area will be proportional to the bounding circle area but scaled by Kx * Kx: \f[\begin{array}{l} dsize.height = \texttt{cvRound}(dsize.width \cdot \Pi) \\ \end{array} \f]
  • if both values in dsize > 0, the destination image will have the given size therefore the area of the bounding circle will be scaled to dsize. \par Reverse mapping You can get reverse mapping adding #WARP_INVERSE_MAP to flags \snippet polar_transforms.cpp InverseMap In addiction, to calculate the original coordinate from a polar mapped coordinate \f$(rho, phi)->(x, y)\f$: \snippet polar_transforms.cpp InverseCoordinate
    • Add #WARP_POLAR_LINEAR to select linear polar mapping (default)
    • Add #WARP_POLAR_LOG to select semilog polar mapping
    • Add #WARP_INVERSE_MAP for reverse mapping. Note:
  • The function can not operate in-place.
  • To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees.
  • This function uses #remap. Due to current implementation limitations the size of an input and output images should be less than 32767x32767. @sa cv::remap

Python prototype (for reference):

warpPolar(src, dsize, center, maxRadius, flags[, dst]) -> dst
Link to this function

watershed(image, markers)

View Source

Performs a marker-based image segmentation using the watershed algorithm. The function implements one of the variants of watershed, non-parametric marker-based segmentation algorithm, described in @cite Meyer92 . Before passing the image to the function, you have to roughly outline the desired regions in the image markers with positive (>0) indices. So, every region is represented as one or more connected components with the pixel values 1, 2, 3, and so on. Such markers can be retrieved from a binary mask using #findContours and #drawContours (see the watershed.cpp demo). The markers are "seeds" of the future image regions. All the other pixels in markers , whose relation to the outlined regions is not known and should be defined by the algorithm, should be set to 0's. In the function output, each pixel in markers is set to a value of the "seed" components or to -1 at boundaries between the regions. Note: Any two neighbor connected components are not necessarily separated by a watershed boundary (-1's pixels); for example, they can touch each other in the initial marker image passed to the function.

size as image .

@sa findContours

Python prototype (for reference):

watershed(image, markers) -> markers
Link to this function

writeOpticalFlow(path, flow)

View Source

Write a .flo to disk The function stores a flow field in a file, returns true on success, false otherwise. The flow field must be a 2-channel, floating-point matrix (CV_32FC2). First channel corresponds to the flow in the horizontal direction (u), second - vertical (v).

Python prototype (for reference):

writeOpticalFlow(path, flow) -> retval

Link to this section Constants

Link to this function

cv_ADAPTIVE_THRESH_GAUSSIAN_C()

View Source
Link to this function

cv_ADAPTIVE_THRESH_MEAN_C()

View Source
Link to this function

cv_BRUTEFORCE_HAMMINGLUT()

View Source
Link to this function

cv_CALIB_CB_ADAPTIVE_THRESH()

View Source
Link to this function

cv_CALIB_CB_ASYMMETRIC_GRID()

View Source
Link to this function

cv_CALIB_CB_CLUSTERING()

View Source
Link to this function

cv_CALIB_CB_EXHAUSTIVE()

View Source
Link to this function

cv_CALIB_CB_FAST_CHECK()

View Source
Link to this function

cv_CALIB_CB_FILTER_QUADS()

View Source
Link to this function

cv_CALIB_CB_NORMALIZE_IMAGE()

View Source
Link to this function

cv_CALIB_CB_SYMMETRIC_GRID()

View Source
Link to this function

cv_CALIB_FIX_ASPECT_RATIO()

View Source
Link to this function

cv_CALIB_FIX_FOCAL_LENGTH()

View Source
Link to this function

cv_CALIB_FIX_INTRINSIC()

View Source
Link to this function

cv_CALIB_FIX_PRINCIPAL_POINT()

View Source
Link to this function

cv_CALIB_FIX_S1_S2_S3_S4()

View Source
Link to this function

cv_CALIB_FIX_TANGENT_DIST()

View Source
Link to this function

cv_CALIB_FIX_TAUX_TAUY()

View Source
Link to this function

cv_CALIB_HAND_EYE_ANDREFF()

View Source
Link to this function

cv_CALIB_HAND_EYE_DANIILIDIS()

View Source
Link to this function

cv_CALIB_HAND_EYE_HORAUD()

View Source
Link to this function

cv_CALIB_HAND_EYE_PARK()

View Source
Link to this function

cv_CALIB_HAND_EYE_TSAI()

View Source
Link to this function

cv_CALIB_RATIONAL_MODEL()

View Source
Link to this function

cv_CALIB_RECOMPUTE_EXTRINSIC()

View Source
Link to this function

cv_CALIB_ROBOT_WORLD_HAND_EYE_LI()

View Source
Link to this function

cv_CALIB_ROBOT_WORLD_HAND_EYE_SHAH()

View Source
Link to this function

cv_CALIB_SAME_FOCAL_LENGTH()

View Source
Link to this function

cv_CALIB_THIN_PRISM_MODEL()

View Source
Link to this function

cv_CALIB_USE_EXTRINSIC_GUESS()

View Source
Link to this function

cv_CALIB_USE_INTRINSIC_GUESS()

View Source
Link to this function

cv_CALIB_ZERO_DISPARITY()

View Source
Link to this function

cv_CALIB_ZERO_TANGENT_DIST()

View Source
Link to this function

cv_CAP_INTELPERC_DEPTH_GENERATOR()

View Source
Link to this function

cv_CAP_INTELPERC_DEPTH_MAP()

View Source
Link to this function

cv_CAP_INTELPERC_GENERATORS_MASK()

View Source
Link to this function

cv_CAP_INTELPERC_IMAGE()

View Source
Link to this function

cv_CAP_INTELPERC_IMAGE_GENERATOR()

View Source
Link to this function

cv_CAP_INTELPERC_IR_GENERATOR()

View Source
Link to this function

cv_CAP_INTELPERC_IR_MAP()

View Source
Link to this function

cv_CAP_INTELPERC_UVDEPTH_MAP()

View Source
Link to this function

cv_CAP_OPENNI_BGR_IMAGE()

View Source
Link to this function

cv_CAP_OPENNI_DEPTH_GENERATOR()

View Source
Link to this function

cv_CAP_OPENNI_DEPTH_GENERATOR_BASELINE()

View Source
Link to this function

cv_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH()

View Source
Link to this function

cv_CAP_OPENNI_DEPTH_GENERATOR_PRESENT()

View Source
Link to this function

cv_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION()

View Source
Link to this function

cv_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON()

View Source
Link to this function

cv_CAP_OPENNI_DEPTH_MAP()

View Source
Link to this function

cv_CAP_OPENNI_DISPARITY_MAP()

View Source
Link to this function

cv_CAP_OPENNI_DISPARITY_MAP_32F()

View Source
Link to this function

cv_CAP_OPENNI_GENERATORS_MASK()

View Source
Link to this function

cv_CAP_OPENNI_GRAY_IMAGE()

View Source
Link to this function

cv_CAP_OPENNI_IMAGE_GENERATOR()

View Source
Link to this function

cv_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE()

View Source
Link to this function

cv_CAP_OPENNI_IMAGE_GENERATOR_PRESENT()

View Source
Link to this function

cv_CAP_OPENNI_IR_GENERATOR()

View Source
Link to this function

cv_CAP_OPENNI_IR_GENERATOR_PRESENT()

View Source
Link to this function

cv_CAP_OPENNI_IR_IMAGE()

View Source
Link to this function

cv_CAP_OPENNI_POINT_CLOUD_MAP()

View Source
Link to this function

cv_CAP_OPENNI_QVGA_30HZ()

View Source
Link to this function

cv_CAP_OPENNI_QVGA_60HZ()

View Source
Link to this function

cv_CAP_OPENNI_SXGA_15HZ()

View Source
Link to this function

cv_CAP_OPENNI_SXGA_30HZ()

View Source
Link to this function

cv_CAP_OPENNI_VALID_DEPTH_MASK()

View Source
Link to this function

cv_CAP_OPENNI_VGA_30HZ()

View Source
Link to this function

cv_CAP_PROP_ARAVIS_AUTOTRIGGER()

View Source
Link to this function

cv_CAP_PROP_AUDIO_BASE_INDEX()

View Source
Link to this function

cv_CAP_PROP_AUDIO_DATA_DEPTH()

View Source
Link to this function

cv_CAP_PROP_AUDIO_SAMPLES_PER_SECOND()

View Source
Link to this function

cv_CAP_PROP_AUDIO_SHIFT_NSEC()

View Source
Link to this function

cv_CAP_PROP_AUDIO_STREAM()

View Source
Link to this function

cv_CAP_PROP_AUDIO_SYNCHRONIZE()

View Source
Link to this function

cv_CAP_PROP_AUDIO_TOTAL_CHANNELS()

View Source
Link to this function

cv_CAP_PROP_AUDIO_TOTAL_STREAMS()

View Source
Link to this function

cv_CAP_PROP_AUTO_EXPOSURE()

View Source
Link to this function

cv_CAP_PROP_BRIGHTNESS()

View Source
Link to this function

cv_CAP_PROP_BUFFERSIZE()

View Source
Link to this function

cv_CAP_PROP_CODEC_EXTRADATA_INDEX()

View Source
Link to this function

cv_CAP_PROP_CODEC_PIXEL_FORMAT()

View Source
Link to this function

cv_CAP_PROP_CONVERT_RGB()

View Source
Link to this function

cv_CAP_PROP_DC1394_MAX()

View Source
Link to this function

cv_CAP_PROP_DC1394_MODE_AUTO()

View Source
Link to this function

cv_CAP_PROP_DC1394_MODE_MANUAL()

View Source
Link to this function

cv_CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO()

View Source
Link to this function

cv_CAP_PROP_DC1394_OFF()

View Source
Link to this function

cv_CAP_PROP_EXPOSUREPROGRAM()

View Source
Link to this function

cv_CAP_PROP_FRAME_COUNT()

View Source
Link to this function

cv_CAP_PROP_FRAME_HEIGHT()

View Source
Link to this function

cv_CAP_PROP_FRAME_WIDTH()

View Source
Link to this function

cv_CAP_PROP_GIGA_FRAME_HEIGH_MAX()

View Source
Link to this function

cv_CAP_PROP_GIGA_FRAME_OFFSET_X()

View Source
Link to this function

cv_CAP_PROP_GIGA_FRAME_OFFSET_Y()

View Source
Link to this function

cv_CAP_PROP_GIGA_FRAME_SENS_HEIGH()

View Source
Link to this function

cv_CAP_PROP_GIGA_FRAME_SENS_WIDTH()

View Source
Link to this function

cv_CAP_PROP_GIGA_FRAME_WIDTH_MAX()

View Source
Link to this function

cv_CAP_PROP_GPHOTO2_COLLECT_MSGS()

View Source
Link to this function

cv_CAP_PROP_GPHOTO2_FLUSH_MSGS()

View Source
Link to this function

cv_CAP_PROP_GPHOTO2_PREVIEW()

View Source
Link to this function

cv_CAP_PROP_GPHOTO2_RELOAD_CONFIG()

View Source
Link to this function

cv_CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE()

View Source
Link to this function

cv_CAP_PROP_GPHOTO2_WIDGET_ENUMERATE()

View Source
Link to this function

cv_CAP_PROP_GSTREAMER_QUEUE_LENGTH()

View Source
Link to this function

cv_CAP_PROP_HW_ACCELERATION()

View Source
Link to this function

cv_CAP_PROP_HW_ACCELERATION_USE_OPENCL()

View Source
Link to this function

cv_CAP_PROP_IMAGES_BASE()

View Source
Link to this function

cv_CAP_PROP_IMAGES_LAST()

View Source
Link to this function

cv_CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD()

View Source
Link to this function

cv_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ()

View Source
Link to this function

cv_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT()

View Source
Link to this function

cv_CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE()

View Source
Link to this function

cv_CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE()

View Source
Link to this function

cv_CAP_PROP_INTELPERC_PROFILE_COUNT()

View Source
Link to this function

cv_CAP_PROP_INTELPERC_PROFILE_IDX()

View Source
Link to this function

cv_CAP_PROP_IOS_DEVICE_EXPOSURE()

View Source
Link to this function

cv_CAP_PROP_IOS_DEVICE_FLASH()

View Source
Link to this function

cv_CAP_PROP_IOS_DEVICE_FOCUS()

View Source
Link to this function

cv_CAP_PROP_IOS_DEVICE_TORCH()

View Source
Link to this function

cv_CAP_PROP_IOS_DEVICE_WHITEBALANCE()

View Source
Link to this function

cv_CAP_PROP_LRF_HAS_KEY_FRAME()

View Source
Link to this function

cv_CAP_PROP_MONOCHROME()

View Source
Link to this function

cv_CAP_PROP_OPEN_TIMEOUT_MSEC()

View Source
Link to this function

cv_CAP_PROP_OPENNI2_MIRROR()

View Source
Link to this function

cv_CAP_PROP_OPENNI2_SYNC()

View Source
Link to this function

cv_CAP_PROP_OPENNI_APPROX_FRAME_SYNC()

View Source
Link to this function

cv_CAP_PROP_OPENNI_BASELINE()

View Source
Link to this function

cv_CAP_PROP_OPENNI_CIRCLE_BUFFER()

View Source
Link to this function

cv_CAP_PROP_OPENNI_FOCAL_LENGTH()

View Source
Link to this function

cv_CAP_PROP_OPENNI_FRAME_MAX_DEPTH()

View Source
Link to this function

cv_CAP_PROP_OPENNI_GENERATOR_PRESENT()

View Source
Link to this function

cv_CAP_PROP_OPENNI_MAX_BUFFER_SIZE()

View Source
Link to this function

cv_CAP_PROP_OPENNI_MAX_TIME_DURATION()

View Source
Link to this function

cv_CAP_PROP_OPENNI_OUTPUT_MODE()

View Source
Link to this function

cv_CAP_PROP_OPENNI_REGISTRATION()

View Source
Link to this function

cv_CAP_PROP_OPENNI_REGISTRATION_ON()

View Source
Link to this function

cv_CAP_PROP_ORIENTATION_AUTO()

View Source
Link to this function

cv_CAP_PROP_ORIENTATION_META()

View Source
Link to this function

cv_CAP_PROP_POS_AVI_RATIO()

View Source
Link to this function

cv_CAP_PROP_POS_FRAMES()

View Source
Link to this function

cv_CAP_PROP_PVAPI_BINNINGX()

View Source
Link to this function

cv_CAP_PROP_PVAPI_BINNINGY()

View Source
Link to this function

cv_CAP_PROP_PVAPI_DECIMATIONHORIZONTAL()

View Source
Link to this function

cv_CAP_PROP_PVAPI_DECIMATIONVERTICAL()

View Source
Link to this function

cv_CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE()

View Source
Link to this function

cv_CAP_PROP_PVAPI_MULTICASTIP()

View Source
Link to this function

cv_CAP_PROP_PVAPI_PIXELFORMAT()

View Source
Link to this function

cv_CAP_PROP_READ_TIMEOUT_MSEC()

View Source
Link to this function

cv_CAP_PROP_RECTIFICATION()

View Source
Link to this function

cv_CAP_PROP_SATURATION()

View Source
Link to this function

cv_CAP_PROP_STREAM_OPEN_TIME_USEC()

View Source
Link to this function

cv_CAP_PROP_TEMPERATURE()

View Source
Link to this function

cv_CAP_PROP_TRIGGER_DELAY()

View Source
Link to this function

cv_CAP_PROP_VIDEO_STREAM()

View Source
Link to this function

cv_CAP_PROP_VIDEO_TOTAL_CHANNELS()

View Source
Link to this function

cv_CAP_PROP_VIEWFINDER()

View Source
Link to this function

cv_CAP_PROP_WB_TEMPERATURE()

View Source
Link to this function

cv_CAP_PROP_WHITE_BALANCE_BLUE_U()

View Source
Link to this function

cv_CAP_PROP_WHITE_BALANCE_RED_V()

View Source
Link to this function

cv_CAP_PROP_XI_ACQ_BUFFER_SIZE()

View Source
Link to this function

cv_CAP_PROP_XI_ACQ_BUFFER_SIZE_UNIT()

View Source
Link to this function

cv_CAP_PROP_XI_ACQ_FRAME_BURST_COUNT()

View Source
Link to this function

cv_CAP_PROP_XI_ACQ_TIMING_MODE()

View Source
Link to this function

cv_CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_COMMIT()

View Source
Link to this function

cv_CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_SIZE()

View Source
Link to this function

cv_CAP_PROP_XI_AE_MAX_LIMIT()

View Source
Link to this function

cv_CAP_PROP_XI_AEAG_LEVEL()

View Source
Link to this function

cv_CAP_PROP_XI_AEAG_ROI_HEIGHT()

View Source
Link to this function

cv_CAP_PROP_XI_AEAG_ROI_OFFSET_X()

View Source
Link to this function

cv_CAP_PROP_XI_AEAG_ROI_OFFSET_Y()

View Source
Link to this function

cv_CAP_PROP_XI_AEAG_ROI_WIDTH()

View Source
Link to this function

cv_CAP_PROP_XI_AG_MAX_LIMIT()

View Source
Link to this function

cv_CAP_PROP_XI_APPLY_CMS()

View Source
Link to this function

cv_CAP_PROP_XI_AUTO_BANDWIDTH_CALCULATION()

View Source
Link to this function

cv_CAP_PROP_XI_AUTO_WB()

View Source
Link to this function

cv_CAP_PROP_XI_AVAILABLE_BANDWIDTH()

View Source
Link to this function

cv_CAP_PROP_XI_BINNING_HORIZONTAL()

View Source
Link to this function

cv_CAP_PROP_XI_BINNING_PATTERN()

View Source
Link to this function

cv_CAP_PROP_XI_BINNING_SELECTOR()

View Source
Link to this function

cv_CAP_PROP_XI_BINNING_VERTICAL()

View Source
Link to this function

cv_CAP_PROP_XI_BUFFER_POLICY()

View Source
Link to this function

cv_CAP_PROP_XI_BUFFERS_QUEUE_SIZE()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_00()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_01()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_02()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_03()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_10()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_11()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_12()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_13()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_20()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_21()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_22()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_23()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_30()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_31()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_32()

View Source
Link to this function

cv_CAP_PROP_XI_CC_MATRIX_33()

View Source
Link to this function

cv_CAP_PROP_XI_CHIP_TEMP()

View Source
Link to this function

cv_CAP_PROP_XI_COLOR_FILTER_ARRAY()

View Source
Link to this function

cv_CAP_PROP_XI_COLUMN_FPN_CORRECTION()

View Source
Link to this function

cv_CAP_PROP_XI_COOLING()

View Source
Link to this function

cv_CAP_PROP_XI_COUNTER_SELECTOR()

View Source
Link to this function

cv_CAP_PROP_XI_COUNTER_VALUE()

View Source
Link to this function

cv_CAP_PROP_XI_DATA_FORMAT()

View Source
Link to this function

cv_CAP_PROP_XI_DEBOUNCE_EN()

View Source
Link to this function

cv_CAP_PROP_XI_DEBOUNCE_POL()

View Source
Link to this function

cv_CAP_PROP_XI_DEBOUNCE_T0()

View Source
Link to this function

cv_CAP_PROP_XI_DEBOUNCE_T1()

View Source
Link to this function

cv_CAP_PROP_XI_DEBUG_LEVEL()

View Source
Link to this function

cv_CAP_PROP_XI_DECIMATION_HORIZONTAL()

View Source
Link to this function

cv_CAP_PROP_XI_DECIMATION_PATTERN()

View Source
Link to this function

cv_CAP_PROP_XI_DECIMATION_SELECTOR()

View Source
Link to this function

cv_CAP_PROP_XI_DECIMATION_VERTICAL()

View Source
Link to this function

cv_CAP_PROP_XI_DEFAULT_CC_MATRIX()

View Source
Link to this function

cv_CAP_PROP_XI_DEVICE_MODEL_ID()

View Source
Link to this function

cv_CAP_PROP_XI_DEVICE_RESET()

View Source
Link to this function

cv_CAP_PROP_XI_DEVICE_SN()

View Source
Link to this function

cv_CAP_PROP_XI_DOWNSAMPLING()

View Source
Link to this function

cv_CAP_PROP_XI_DOWNSAMPLING_TYPE()

View Source
Link to this function

cv_CAP_PROP_XI_EXP_PRIORITY()

View Source
Link to this function

cv_CAP_PROP_XI_EXPOSURE()

View Source
Link to this function

cv_CAP_PROP_XI_EXPOSURE_BURST_COUNT()

View Source
Link to this function

cv_CAP_PROP_XI_FFS_ACCESS_KEY()

View Source
Link to this function

cv_CAP_PROP_XI_FFS_FILE_ID()

View Source
Link to this function

cv_CAP_PROP_XI_FFS_FILE_SIZE()

View Source
Link to this function

cv_CAP_PROP_XI_FRAMERATE()

View Source
Link to this function

cv_CAP_PROP_XI_FREE_FFS_SIZE()

View Source
Link to this function

cv_CAP_PROP_XI_GAIN_SELECTOR()

View Source
Link to this function

cv_CAP_PROP_XI_GPI_LEVEL()

View Source
Link to this function

cv_CAP_PROP_XI_GPI_MODE()

View Source
Link to this function

cv_CAP_PROP_XI_GPI_SELECTOR()

View Source
Link to this function

cv_CAP_PROP_XI_GPO_MODE()

View Source
Link to this function

cv_CAP_PROP_XI_GPO_SELECTOR()

View Source
Link to this function

cv_CAP_PROP_XI_HDR_KNEEPOINT_COUNT()

View Source
Link to this function

cv_CAP_PROP_XI_HOUS_BACK_SIDE_TEMP()

View Source
Link to this function

cv_CAP_PROP_XI_HOUS_TEMP()

View Source
Link to this function

cv_CAP_PROP_XI_HW_REVISION()

View Source
Link to this function

cv_CAP_PROP_XI_IMAGE_BLACK_LEVEL()

View Source
Link to this function

cv_CAP_PROP_XI_IMAGE_DATA_BIT_DEPTH()

View Source
Link to this function

cv_CAP_PROP_XI_IMAGE_DATA_FORMAT()

View Source
Link to this function

cv_CAP_PROP_XI_IMAGE_DATA_FORMAT_RGB32_ALPHA()

View Source
Link to this function

cv_CAP_PROP_XI_IMAGE_IS_COLOR()

View Source
Link to this function

cv_CAP_PROP_XI_IMAGE_PAYLOAD_SIZE()

View Source
Link to this function

cv_CAP_PROP_XI_IS_COOLED()

View Source
Link to this function

cv_CAP_PROP_XI_IS_DEVICE_EXIST()

View Source
Link to this function

cv_CAP_PROP_XI_KNEEPOINT1()

View Source
Link to this function

cv_CAP_PROP_XI_KNEEPOINT2()

View Source
Link to this function

cv_CAP_PROP_XI_LED_MODE()

View Source
Link to this function

cv_CAP_PROP_XI_LED_SELECTOR()

View Source
Link to this function

cv_CAP_PROP_XI_LENS_APERTURE_VALUE()

View Source
Link to this function

cv_CAP_PROP_XI_LENS_FEATURE()

View Source
Link to this function

cv_CAP_PROP_XI_LENS_FEATURE_SELECTOR()

View Source
Link to this function

cv_CAP_PROP_XI_LENS_FOCAL_LENGTH()

View Source
Link to this function

cv_CAP_PROP_XI_LENS_FOCUS_DISTANCE()

View Source
Link to this function

cv_CAP_PROP_XI_LENS_FOCUS_MOVE()

View Source
Link to this function

cv_CAP_PROP_XI_LENS_FOCUS_MOVEMENT_VALUE()

View Source
Link to this function

cv_CAP_PROP_XI_LENS_MODE()

View Source
Link to this function

cv_CAP_PROP_XI_LIMIT_BANDWIDTH()

View Source
Link to this function

cv_CAP_PROP_XI_LUT_INDEX()

View Source
Link to this function

cv_CAP_PROP_XI_LUT_VALUE()

View Source
Link to this function

cv_CAP_PROP_XI_MANUAL_WB()

View Source
Link to this function

cv_CAP_PROP_XI_OFFSET_X()

View Source
Link to this function

cv_CAP_PROP_XI_OFFSET_Y()

View Source
Link to this function

cv_CAP_PROP_XI_OUTPUT_DATA_BIT_DEPTH()

View Source
Link to this function

cv_CAP_PROP_XI_OUTPUT_DATA_PACKING()

View Source
Link to this function

cv_CAP_PROP_XI_OUTPUT_DATA_PACKING_TYPE()

View Source
Link to this function

cv_CAP_PROP_XI_RECENT_FRAME()

View Source
Link to this function

cv_CAP_PROP_XI_REGION_MODE()

View Source
Link to this function

cv_CAP_PROP_XI_REGION_SELECTOR()

View Source
Link to this function

cv_CAP_PROP_XI_ROW_FPN_CORRECTION()

View Source
Link to this function

cv_CAP_PROP_XI_SENSOR_BOARD_TEMP()

View Source
Link to this function

cv_CAP_PROP_XI_SENSOR_CLOCK_FREQ_HZ()

View Source
Link to this function

cv_CAP_PROP_XI_SENSOR_CLOCK_FREQ_INDEX()

View Source
Link to this function

cv_CAP_PROP_XI_SENSOR_DATA_BIT_DEPTH()

View Source
Link to this function

cv_CAP_PROP_XI_SENSOR_FEATURE_SELECTOR()

View Source
Link to this function

cv_CAP_PROP_XI_SENSOR_FEATURE_VALUE()

View Source
Link to this function

cv_CAP_PROP_XI_SENSOR_MODE()

View Source
Link to this function

cv_CAP_PROP_XI_SENSOR_OUTPUT_CHANNEL_COUNT()

View Source
Link to this function

cv_CAP_PROP_XI_SENSOR_TAPS()

View Source
Link to this function

cv_CAP_PROP_XI_SHARPNESS()

View Source
Link to this function

cv_CAP_PROP_XI_SHUTTER_TYPE()

View Source
Link to this function

cv_CAP_PROP_XI_TARGET_TEMP()

View Source
Link to this function

cv_CAP_PROP_XI_TEST_PATTERN()

View Source
Link to this function

cv_CAP_PROP_XI_TEST_PATTERN_GENERATOR_SELECTOR()

View Source
Link to this function

cv_CAP_PROP_XI_TIMEOUT()

View Source
Link to this function

cv_CAP_PROP_XI_TRANSPORT_PIXEL_FORMAT()

View Source
Link to this function

cv_CAP_PROP_XI_TRG_DELAY()

View Source
Link to this function

cv_CAP_PROP_XI_TRG_SELECTOR()

View Source
Link to this function

cv_CAP_PROP_XI_TRG_SOFTWARE()

View Source
Link to this function

cv_CAP_PROP_XI_TRG_SOURCE()

View Source
Link to this function

cv_CAP_PROP_XI_TS_RST_MODE()

View Source
Link to this function

cv_CAP_PROP_XI_TS_RST_SOURCE()

View Source
Link to this function

cv_CAP_PROP_XI_USED_FFS_SIZE()

View Source
Link to this function

cv_CAP_PVAPI_DECIMATION_2OUTOF4()

View Source
Link to this function

cv_CAP_PVAPI_DECIMATION_2OUTOF8()

View Source
Link to this function

cv_CAP_PVAPI_DECIMATION_2OUTOF16()

View Source
Link to this function

cv_CAP_PVAPI_DECIMATION_OFF()

View Source
Link to this function

cv_CAP_PVAPI_FSTRIGMODE_FIXEDRATE()

View Source
Link to this function

cv_CAP_PVAPI_FSTRIGMODE_FREERUN()

View Source
Link to this function

cv_CAP_PVAPI_FSTRIGMODE_SOFTWARE()

View Source
Link to this function

cv_CAP_PVAPI_FSTRIGMODE_SYNCIN1()

View Source
Link to this function

cv_CAP_PVAPI_FSTRIGMODE_SYNCIN2()

View Source
Link to this function

cv_CAP_PVAPI_PIXELFORMAT_BAYER8()

View Source
Link to this function

cv_CAP_PVAPI_PIXELFORMAT_BAYER16()

View Source
Link to this function

cv_CAP_PVAPI_PIXELFORMAT_BGR24()

View Source
Link to this function

cv_CAP_PVAPI_PIXELFORMAT_BGRA32()

View Source
Link to this function

cv_CAP_PVAPI_PIXELFORMAT_MONO8()

View Source
Link to this function

cv_CAP_PVAPI_PIXELFORMAT_MONO16()

View Source
Link to this function

cv_CAP_PVAPI_PIXELFORMAT_RGB24()

View Source
Link to this function

cv_CAP_PVAPI_PIXELFORMAT_RGBA32()

View Source
Link to this function

cv_CASCADE_DO_CANNY_PRUNING()

View Source
Link to this function

cv_CASCADE_DO_ROUGH_SEARCH()

View Source
Link to this function

cv_CASCADE_FIND_BIGGEST_OBJECT()

View Source
Link to this function

cv_CASCADE_SCALE_IMAGE()

View Source
Link to this function

cv_CHAIN_APPROX_SIMPLE()

View Source
Link to this function

cv_CHAIN_APPROX_TC89_KCOS()

View Source
Link to this function

cv_CHAIN_APPROX_TC89_L1()

View Source
Link to this function

cv_COLOR_BayerBG2BGR_EA()

View Source
Link to this function

cv_COLOR_BayerBG2BGR_VNG()

View Source
Link to this function

cv_COLOR_BayerBG2RGB_EA()

View Source
Link to this function

cv_COLOR_BayerBG2RGB_VNG()

View Source
Link to this function

cv_COLOR_BayerBGGR2BGR()

View Source
Link to this function

cv_COLOR_BayerBGGR2BGR_EA()

View Source
Link to this function

cv_COLOR_BayerBGGR2BGR_VNG()

View Source
Link to this function

cv_COLOR_BayerBGGR2BGRA()

View Source
Link to this function

cv_COLOR_BayerBGGR2GRAY()

View Source
Link to this function

cv_COLOR_BayerBGGR2RGB()

View Source
Link to this function

cv_COLOR_BayerBGGR2RGB_EA()

View Source
Link to this function

cv_COLOR_BayerBGGR2RGB_VNG()

View Source
Link to this function

cv_COLOR_BayerBGGR2RGBA()

View Source
Link to this function

cv_COLOR_BayerGB2BGR_EA()

View Source
Link to this function

cv_COLOR_BayerGB2BGR_VNG()

View Source
Link to this function

cv_COLOR_BayerGB2RGB_EA()

View Source
Link to this function

cv_COLOR_BayerGB2RGB_VNG()

View Source
Link to this function

cv_COLOR_BayerGBRG2BGR()

View Source
Link to this function

cv_COLOR_BayerGBRG2BGR_EA()

View Source
Link to this function

cv_COLOR_BayerGBRG2BGR_VNG()

View Source
Link to this function

cv_COLOR_BayerGBRG2BGRA()

View Source
Link to this function

cv_COLOR_BayerGBRG2GRAY()

View Source
Link to this function

cv_COLOR_BayerGBRG2RGB()

View Source
Link to this function

cv_COLOR_BayerGBRG2RGB_EA()

View Source
Link to this function

cv_COLOR_BayerGBRG2RGB_VNG()

View Source
Link to this function

cv_COLOR_BayerGBRG2RGBA()

View Source
Link to this function

cv_COLOR_BayerGR2BGR_EA()

View Source
Link to this function

cv_COLOR_BayerGR2BGR_VNG()

View Source
Link to this function

cv_COLOR_BayerGR2RGB_EA()

View Source
Link to this function

cv_COLOR_BayerGR2RGB_VNG()

View Source
Link to this function

cv_COLOR_BayerGRBG2BGR()

View Source
Link to this function

cv_COLOR_BayerGRBG2BGR_EA()

View Source
Link to this function

cv_COLOR_BayerGRBG2BGR_VNG()

View Source
Link to this function

cv_COLOR_BayerGRBG2BGRA()

View Source
Link to this function

cv_COLOR_BayerGRBG2GRAY()

View Source
Link to this function

cv_COLOR_BayerGRBG2RGB()

View Source
Link to this function

cv_COLOR_BayerGRBG2RGB_EA()

View Source
Link to this function

cv_COLOR_BayerGRBG2RGB_VNG()

View Source
Link to this function

cv_COLOR_BayerGRBG2RGBA()

View Source
Link to this function

cv_COLOR_BayerRG2BGR_EA()

View Source
Link to this function

cv_COLOR_BayerRG2BGR_VNG()

View Source
Link to this function

cv_COLOR_BayerRG2RGB_EA()

View Source
Link to this function

cv_COLOR_BayerRG2RGB_VNG()

View Source
Link to this function

cv_COLOR_BayerRGGB2BGR()

View Source
Link to this function

cv_COLOR_BayerRGGB2BGR_EA()

View Source
Link to this function

cv_COLOR_BayerRGGB2BGR_VNG()

View Source
Link to this function

cv_COLOR_BayerRGGB2BGRA()

View Source
Link to this function

cv_COLOR_BayerRGGB2GRAY()

View Source
Link to this function

cv_COLOR_BayerRGGB2RGB()

View Source
Link to this function

cv_COLOR_BayerRGGB2RGB_EA()

View Source
Link to this function

cv_COLOR_BayerRGGB2RGB_VNG()

View Source
Link to this function

cv_COLOR_BayerRGGB2RGBA()

View Source
Link to this function

cv_COLOR_BGRA2YUV_I420()

View Source
Link to this function

cv_COLOR_BGRA2YUV_IYUV()

View Source
Link to this function

cv_COLOR_BGRA2YUV_YV12()

View Source
Link to this function

cv_COLOR_RGBA2YUV_I420()

View Source
Link to this function

cv_COLOR_RGBA2YUV_IYUV()

View Source
Link to this function

cv_COLOR_RGBA2YUV_YV12()

View Source
Link to this function

cv_COLOR_YUV2BGRA_I420()

View Source
Link to this function

cv_COLOR_YUV2BGRA_IYUV()

View Source
Link to this function

cv_COLOR_YUV2BGRA_NV12()

View Source
Link to this function

cv_COLOR_YUV2BGRA_NV21()

View Source
Link to this function

cv_COLOR_YUV2BGRA_UYNV()

View Source
Link to this function

cv_COLOR_YUV2BGRA_UYVY()

View Source
Link to this function

cv_COLOR_YUV2BGRA_Y422()

View Source
Link to this function

cv_COLOR_YUV2BGRA_YUNV()

View Source
Link to this function

cv_COLOR_YUV2BGRA_YUY2()

View Source
Link to this function

cv_COLOR_YUV2BGRA_YUYV()

View Source
Link to this function

cv_COLOR_YUV2BGRA_YV12()

View Source
Link to this function

cv_COLOR_YUV2BGRA_YVYU()

View Source
Link to this function

cv_COLOR_YUV2GRAY_I420()

View Source
Link to this function

cv_COLOR_YUV2GRAY_IYUV()

View Source
Link to this function

cv_COLOR_YUV2GRAY_NV12()

View Source
Link to this function

cv_COLOR_YUV2GRAY_NV21()

View Source
Link to this function

cv_COLOR_YUV2GRAY_UYNV()

View Source
Link to this function

cv_COLOR_YUV2GRAY_UYVY()

View Source
Link to this function

cv_COLOR_YUV2GRAY_Y422()

View Source
Link to this function

cv_COLOR_YUV2GRAY_YUNV()

View Source
Link to this function

cv_COLOR_YUV2GRAY_YUY2()

View Source
Link to this function

cv_COLOR_YUV2GRAY_YUYV()

View Source
Link to this function

cv_COLOR_YUV2GRAY_YV12()

View Source
Link to this function

cv_COLOR_YUV2GRAY_YVYU()

View Source
Link to this function

cv_COLOR_YUV2RGBA_I420()

View Source
Link to this function

cv_COLOR_YUV2RGBA_IYUV()

View Source
Link to this function

cv_COLOR_YUV2RGBA_NV12()

View Source
Link to this function

cv_COLOR_YUV2RGBA_NV21()

View Source
Link to this function

cv_COLOR_YUV2RGBA_UYNV()

View Source
Link to this function

cv_COLOR_YUV2RGBA_UYVY()

View Source
Link to this function

cv_COLOR_YUV2RGBA_Y422()

View Source
Link to this function

cv_COLOR_YUV2RGBA_YUNV()

View Source
Link to this function

cv_COLOR_YUV2RGBA_YUY2()

View Source
Link to this function

cv_COLOR_YUV2RGBA_YUYV()

View Source
Link to this function

cv_COLOR_YUV2RGBA_YV12()

View Source
Link to this function

cv_COLOR_YUV2RGBA_YVYU()

View Source
Link to this function

cv_COLOR_YUV420sp2BGRA()

View Source
Link to this function

cv_COLOR_YUV420sp2GRAY()

View Source
Link to this function

cv_COLOR_YUV420sp2RGBA()

View Source
Link to this function

cv_COLORMAP_TWILIGHT_SHIFTED()

View Source
Link to this function

cv_ComputeModeExclusive()

View Source
Link to this function

cv_ComputeModeExclusiveProcess()

View Source
Link to this function

cv_ComputeModeProhibited()

View Source
Link to this function

cv_DEPTH_MASK_ALL_BUT_8S()

View Source
Link to this function

cv_DESCR_FORMAT_COL_BY_COL()

View Source
Link to this function

cv_DESCR_FORMAT_ROW_BY_ROW()

View Source
Link to this function

cv_DESCRIPTOR_KAZE_UPRIGHT()

View Source
Link to this function

cv_DESCRIPTOR_MLDB_UPRIGHT()

View Source
Link to this function

cv_DEVICE_COPY_OBSOLETE()

View Source
Link to this function

cv_DNN_BACKEND_DEFAULT()

View Source
Link to this function

cv_DNN_BACKEND_INFERENCE_ENGINE()

View Source
Link to this function

cv_DNN_TARGET_CUDA_FP16()

View Source
Link to this function

cv_DNN_TARGET_OPENCL_FP16()

View Source
Link to this function

cv_DRAW_RICH_KEYPOINTS()

View Source
Link to this function

cv_DYNAMIC_PARALLELISM()

View Source
Link to this function

cv_ELEMENT_ARRAY_BUFFER()

View Source
Link to this function

cv_ERR_CAMERA_PARAMS_ADJUST_FAIL()

View Source
Link to this function

cv_ERR_HOMOGRAPHY_EST_FAIL()

View Source
Link to this function

cv_EULER_ANGLES_MAX_VALUE()

View Source
Link to this function

cv_EVENT_FLAG_SHIFTKEY()

View Source
Link to this function

cv_EVENT_LBUTTONDBLCLK()

View Source
Link to this function

cv_EVENT_MBUTTONDBLCLK()

View Source
Link to this function

cv_EVENT_RBUTTONDBLCLK()

View Source
Link to this function

cv_FEATURE_SET_COMPUTE_10()

View Source
Link to this function

cv_FEATURE_SET_COMPUTE_11()

View Source
Link to this function

cv_FEATURE_SET_COMPUTE_12()

View Source
Link to this function

cv_FEATURE_SET_COMPUTE_13()

View Source
Link to this function

cv_FEATURE_SET_COMPUTE_20()

View Source
Link to this function

cv_FEATURE_SET_COMPUTE_21()

View Source
Link to this function

cv_FEATURE_SET_COMPUTE_30()

View Source
Link to this function

cv_FEATURE_SET_COMPUTE_32()

View Source
Link to this function

cv_FEATURE_SET_COMPUTE_35()

View Source
Link to this function

cv_FEATURE_SET_COMPUTE_50()

View Source
Link to this function

cv_FLANN_INDEX_TYPE_8S()

View Source
Link to this function

cv_FLANN_INDEX_TYPE_8U()

View Source
Link to this function

cv_FLANN_INDEX_TYPE_16S()

View Source
Link to this function

cv_FLANN_INDEX_TYPE_16U()

View Source
Link to this function

cv_FLANN_INDEX_TYPE_32F()

View Source
Link to this function

cv_FLANN_INDEX_TYPE_32S()

View Source
Link to this function

cv_FLANN_INDEX_TYPE_64F()

View Source
Link to this function

cv_FLANN_INDEX_TYPE_ALGORITHM()

View Source
Link to this function

cv_FLANN_INDEX_TYPE_BOOL()

View Source
Link to this function

cv_FLANN_INDEX_TYPE_STRING()

View Source
Link to this function

cv_FLOODFILL_FIXED_RANGE()

View Source
Link to this function

cv_FLOODFILL_MASK_ONLY()

View Source
Link to this function

cv_FONT_HERSHEY_COMPLEX()

View Source
Link to this function

cv_FONT_HERSHEY_COMPLEX_SMALL()

View Source
Link to this function

cv_FONT_HERSHEY_DUPLEX()

View Source
Link to this function

cv_FONT_HERSHEY_SCRIPT_COMPLEX()

View Source
Link to this function

cv_FONT_HERSHEY_SCRIPT_SIMPLEX()

View Source
Link to this function

cv_FONT_HERSHEY_SIMPLEX()

View Source
Link to this function

cv_FONT_HERSHEY_TRIPLEX()

View Source
Link to this function

cv_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT()

View Source
Link to this function

cv_FP_ROUND_TO_NEAREST()

View Source
Link to this function

cv_GC_EVAL_FREEZE_MODEL()

View Source
Link to this function

cv_HISTCMP_BHATTACHARYYA()

View Source
Link to this function

cv_HOUGH_PROBABILISTIC()

View Source
Link to this function

cv_IMREAD_IGNORE_ORIENTATION()

View Source
Link to this function

cv_IMREAD_REDUCED_COLOR_2()

View Source
Link to this function

cv_IMREAD_REDUCED_COLOR_4()

View Source
Link to this function

cv_IMREAD_REDUCED_COLOR_8()

View Source
Link to this function

cv_IMREAD_REDUCED_GRAYSCALE_2()

View Source
Link to this function

cv_IMREAD_REDUCED_GRAYSCALE_4()

View Source
Link to this function

cv_IMREAD_REDUCED_GRAYSCALE_8()

View Source
Link to this function

cv_IMWRITE_EXR_COMPRESSION()

View Source
Link to this function

cv_IMWRITE_EXR_COMPRESSION_B44()

View Source
Link to this function

cv_IMWRITE_EXR_COMPRESSION_B44A()

View Source
Link to this function

cv_IMWRITE_EXR_COMPRESSION_DWAA()

View Source
Link to this function

cv_IMWRITE_EXR_COMPRESSION_DWAB()

View Source
Link to this function

cv_IMWRITE_EXR_COMPRESSION_NO()

View Source
Link to this function

cv_IMWRITE_EXR_COMPRESSION_PIZ()

View Source
Link to this function

cv_IMWRITE_EXR_COMPRESSION_PXR24()

View Source
Link to this function

cv_IMWRITE_EXR_COMPRESSION_RLE()

View Source
Link to this function

cv_IMWRITE_EXR_COMPRESSION_ZIP()

View Source
Link to this function

cv_IMWRITE_EXR_COMPRESSION_ZIPS()

View Source
Link to this function

cv_IMWRITE_EXR_TYPE_FLOAT()

View Source
Link to this function

cv_IMWRITE_EXR_TYPE_HALF()

View Source
Link to this function

cv_IMWRITE_JPEG2000_COMPRESSION_X1000()

View Source
Link to this function

cv_IMWRITE_JPEG_CHROMA_QUALITY()

View Source
Link to this function

cv_IMWRITE_JPEG_LUMA_QUALITY()

View Source
Link to this function

cv_IMWRITE_JPEG_OPTIMIZE()

View Source
Link to this function

cv_IMWRITE_JPEG_PROGRESSIVE()

View Source
Link to this function

cv_IMWRITE_JPEG_QUALITY()

View Source
Link to this function

cv_IMWRITE_JPEG_RST_INTERVAL()

View Source
Link to this function

cv_IMWRITE_PAM_FORMAT_BLACKANDWHITE()

View Source
Link to this function

cv_IMWRITE_PAM_FORMAT_GRAYSCALE()

View Source
Link to this function

cv_IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA()

View Source
Link to this function

cv_IMWRITE_PAM_FORMAT_NULL()

View Source
Link to this function

cv_IMWRITE_PAM_FORMAT_RGB()

View Source
Link to this function

cv_IMWRITE_PAM_FORMAT_RGB_ALPHA()

View Source
Link to this function

cv_IMWRITE_PAM_TUPLETYPE()

View Source
Link to this function

cv_IMWRITE_PNG_BILEVEL()

View Source
Link to this function

cv_IMWRITE_PNG_COMPRESSION()

View Source
Link to this function

cv_IMWRITE_PNG_STRATEGY()

View Source
Link to this function

cv_IMWRITE_PNG_STRATEGY_DEFAULT()

View Source
Link to this function

cv_IMWRITE_PNG_STRATEGY_FILTERED()

View Source
Link to this function

cv_IMWRITE_PNG_STRATEGY_FIXED()

View Source
Link to this function

cv_IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY()

View Source
Link to this function

cv_IMWRITE_PNG_STRATEGY_RLE()

View Source
Link to this function

cv_IMWRITE_TIFF_COMPRESSION()

View Source
Link to this function

cv_IMWRITE_TIFF_RESUNIT()

View Source
Link to this function

cv_IMWRITE_WEBP_QUALITY()

View Source
Link to this function

cv_INTER_NEAREST_EXACT()

View Source
Link to this function

cv_KMEANS_RANDOM_CENTERS()

View Source
Link to this function

cv_KMEANS_USE_INITIAL_LABELS()

View Source
Link to this function

cv_LAST_VALUE_FLANN_INDEX_TYPE()

View Source
Link to this function

cv_LOCAL_OPTIM_INNER_AND_ITER_LO()

View Source
Link to this function

cv_LOCAL_OPTIM_INNER_LO()

View Source
Link to this function

cv_MARKER_TILTED_CROSS()

View Source
Link to this function

cv_MARKER_TRIANGLE_DOWN()

View Source
Link to this function

cv_MODE_STRUCTURED_APPEND()

View Source
Link to this function

cv_MONOCHROME_TRANSFER()

View Source
Link to this function

cv_NOT_DRAW_SINGLE_POINTS()

View Source
Link to this function

cv_OPTFLOW_FARNEBACK_GAUSSIAN()

View Source
Link to this function

cv_OPTFLOW_LK_GET_MIN_EIGENVALS()

View Source
Link to this function

cv_OPTFLOW_USE_INITIAL_FLOW()

View Source
Link to this function

cv_OpenCLDoubleNotSupported()

View Source
Link to this function

cv_PIXEL_UNPACK_BUFFER()

View Source
Link to this function

cv_PREFILTER_NORMALIZED_RESPONSE()

View Source
Link to this function

cv_PROJ_SPHERICAL_EQRECT()

View Source
Link to this function

cv_PROJ_SPHERICAL_ORTHO()

View Source
Link to this function

cv_QUAT_ASSUME_NOT_UNIT()

View Source
Link to this function

cv_ROTATE_90_CLOCKWISE()

View Source
Link to this function

cv_ROTATE_90_COUNTERCLOCKWISE()

View Source
Link to this function

cv_SAMPLING_PROGRESSIVE_NAPSAC()

View Source
Link to this function

cv_SCORE_METHOD_MAGSAC()

View Source
Link to this function

cv_SCORE_METHOD_RANSAC()

View Source
Link to this function

cv_SOLVEPNP_IPPE_SQUARE()

View Source
Link to this function

cv_STD_VECTOR_CUDA_GPU_MAT()

View Source
Link to this function

cv_StsFilterStructContentErr()

View Source
Link to this function

cv_StsInplaceNotSupported()

View Source
Link to this function

cv_StsKernelStructContentErr()

View Source
Link to this function

cv_StsUnmatchedFormats()

View Source
Link to this function

cv_StsUnsupportedFormat()

View Source
Link to this function

cv_UMAT_USAGE_FLAGS_32BIT()

View Source
Link to this function

cv_USAGE_ALLOCATE_DEVICE_MEMORY()

View Source
Link to this function

cv_USAGE_ALLOCATE_HOST_MEMORY()

View Source
Link to this function

cv_USAGE_ALLOCATE_SHARED_MEMORY()

View Source
Link to this function

cv_VIDEO_ACCELERATION_ANY()

View Source
Link to this function

cv_VIDEO_ACCELERATION_D3D11()

View Source
Link to this function

cv_VIDEO_ACCELERATION_MFX()

View Source
Link to this function

cv_VIDEO_ACCELERATION_NONE()

View Source
Link to this function

cv_VIDEO_ACCELERATION_VAAPI()

View Source
Link to this function

cv_VIDEOWRITER_PROP_DEPTH()

View Source
Link to this function

cv_VIDEOWRITER_PROP_FRAMEBYTES()

View Source
Link to this function

cv_VIDEOWRITER_PROP_HW_ACCELERATION()

View Source
Link to this function

cv_VIDEOWRITER_PROP_HW_ACCELERATION_USE_OPENCL()

View Source
Link to this function

cv_VIDEOWRITER_PROP_HW_DEVICE()

View Source
Link to this function

cv_VIDEOWRITER_PROP_IS_COLOR()

View Source
Link to this function

cv_VIDEOWRITER_PROP_NSTRIPES()

View Source
Link to this function

cv_VIDEOWRITER_PROP_QUALITY()

View Source
Link to this function

cv_WARP_SHUFFLE_FUNCTIONS()

View Source
Link to this function

cv_WINDOW_GUI_EXPANDED()

View Source
Link to this function

cv_WND_PROP_ASPECT_RATIO()

View Source
Link to this function

cv_WND_PROP_FULLSCREEN()

View Source

Link to this section Functions

return a list of enabled modules in this build

Raising version of absdiff/2.

Link to this function

absdiff!(src1, src2, opts)

View Source

Raising version of absdiff/3.

Raising version of accumulate/2.

Link to this function

accumulate!(src, dst, opts)

View Source

Raising version of accumulate/3.

Link to this function

accumulateProduct!(src1, src2, dst)

View Source

Raising version of accumulateProduct/3.

Link to this function

accumulateProduct!(src1, src2, dst, opts)

View Source

Raising version of accumulateProduct/4.

Link to this function

accumulateSquare!(src, dst)

View Source

Raising version of accumulateSquare/2.

Link to this function

accumulateSquare!(src, dst, opts)

View Source

Raising version of accumulateSquare/3.

Link to this function

accumulateWeighted!(src, dst, alpha)

View Source

Raising version of accumulateWeighted/3.

Link to this function

accumulateWeighted!(src, dst, alpha, opts)

View Source

Raising version of accumulateWeighted/4.

Link to this function

adaptiveThreshold!(src, maxValue, adaptiveMethod, thresholdType, blockSize, c)

View Source

Raising version of adaptiveThreshold/6.

Link to this function

adaptiveThreshold!(src, maxValue, adaptiveMethod, thresholdType, blockSize, c, opts)

View Source

Raising version of adaptiveThreshold/7.

Raising version of add/2.

Raising version of add/3.

Link to this function

addText!(img, text, org, nameFont)

View Source

Raising version of addText/4.

Link to this function

addText!(img, text, org, nameFont, opts)

View Source

Raising version of addText/5.

Link to this function

addWeighted!(src1, alpha, src2, beta, gamma)

View Source

Raising version of addWeighted/5.

Link to this function

addWeighted!(src1, alpha, src2, beta, gamma, opts)

View Source

Raising version of addWeighted/6.

Link to this function

applyColorMap!(src, userColor)

View Source

Raising version of applyColorMap/2.

Link to this function

applyColorMap!(src, userColor, opts)

View Source

Raising version of applyColorMap/3.

Link to this function

approxPolyDP!(curve, epsilon, closed)

View Source

Raising version of approxPolyDP/3.

Link to this function

approxPolyDP!(curve, epsilon, closed, opts)

View Source

Raising version of approxPolyDP/4.

Link to this function

arcLength!(curve, closed)

View Source

Raising version of arcLength/2.

Link to this function

arrowedLine!(img, pt1, pt2, color)

View Source

Raising version of arrowedLine/4.

Link to this function

arrowedLine!(img, pt1, pt2, color, opts)

View Source

Raising version of arrowedLine/5.

Link to this function

batchDistance!(src1, src2, dtype)

View Source

Raising version of batchDistance/3.

Link to this function

batchDistance!(src1, src2, dtype, opts)

View Source

Raising version of batchDistance/4.

Link to this function

bilateralFilter!(src, d, sigmaColor, sigmaSpace)

View Source

Raising version of bilateralFilter/4.

Link to this function

bilateralFilter!(src, d, sigmaColor, sigmaSpace, opts)

View Source

Raising version of bilateralFilter/5.

Link to this function

blendLinear!(src1, src2, weights1, weights2)

View Source

Raising version of blendLinear/4.

Link to this function

blendLinear!(src1, src2, weights1, weights2, opts)

View Source

Raising version of blendLinear/5.

Raising version of blur/2.

Raising version of blur/3.

Link to this function

borderInterpolate!(p, len, borderType)

View Source

Raising version of borderInterpolate/3.

Raising version of boundingRect/1.

Link to this function

boxFilter!(src, ddepth, ksize)

View Source

Raising version of boxFilter/3.

Link to this function

boxFilter!(src, ddepth, ksize, opts)

View Source

Raising version of boxFilter/4.

Raising version of boxPoints/1.

Raising version of boxPoints/2.

Link to this function

buildOpticalFlowPyramid!(img, winSize, maxLevel)

View Source

Raising version of buildOpticalFlowPyramid/3.

Link to this function

buildOpticalFlowPyramid!(img, winSize, maxLevel, opts)

View Source

Raising version of buildOpticalFlowPyramid/4.

Link to this function

calcBackProject!(images, channels, hist, ranges, scale)

View Source

Raising version of calcBackProject/5.

Link to this function

calcBackProject!(images, channels, hist, ranges, scale, opts)

View Source

Raising version of calcBackProject/6.

Link to this function

calcCovarMatrix!(samples, mean, flags)

View Source

Raising version of calcCovarMatrix/3.

Link to this function

calcCovarMatrix!(samples, mean, flags, opts)

View Source

Raising version of calcCovarMatrix/4.

Link to this function

calcHist!(images, channels, mask, histSize, ranges)

View Source

Raising version of calcHist/5.

Link to this function

calcHist!(images, channels, mask, histSize, ranges, opts)

View Source

Raising version of calcHist/6.

Link to this function

calcOpticalFlowFarneback!(prev, next, flow, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags)

View Source

Raising version of calcOpticalFlowFarneback/10.

Link to this function

calcOpticalFlowPyrLK!(prevImg, nextImg, prevPts, nextPts)

View Source

Raising version of calcOpticalFlowPyrLK/4.

Link to this function

calcOpticalFlowPyrLK!(prevImg, nextImg, prevPts, nextPts, opts)

View Source

Raising version of calcOpticalFlowPyrLK/5.

Link to this function

calibrateCamera!(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs)

View Source

Raising version of calibrateCamera/5.

Link to this function

calibrateCamera!(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, opts)

View Source

Raising version of calibrateCamera/6.

Link to this function

calibrateCameraExtended!(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs)

View Source

Raising version of calibrateCameraExtended/5.

Link to this function

calibrateCameraExtended!(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, opts)

View Source

Raising version of calibrateCameraExtended/6.

Link to this function

calibrateCameraRO!(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs)

View Source

Raising version of calibrateCameraRO/6.

Link to this function

calibrateCameraRO!(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs, opts)

View Source

Raising version of calibrateCameraRO/7.

Link to this function

calibrateCameraROExtended!(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs)

View Source

Raising version of calibrateCameraROExtended/6.

Link to this function

calibrateCameraROExtended!(objectPoints, imagePoints, imageSize, iFixedPoint, cameraMatrix, distCoeffs, opts)

View Source

Raising version of calibrateCameraROExtended/7.

Link to this function

calibrateHandEye!(r_gripper2base, t_gripper2base, r_target2cam, t_target2cam)

View Source

Raising version of calibrateHandEye/4.

Link to this function

calibrateHandEye!(r_gripper2base, t_gripper2base, r_target2cam, t_target2cam, opts)

View Source

Raising version of calibrateHandEye/5.

Link to this function

calibrateRobotWorldHandEye!(r_world2cam, t_world2cam, r_base2gripper, t_base2gripper)

View Source

Raising version of calibrateRobotWorldHandEye/4.

Link to this function

calibrateRobotWorldHandEye!(r_world2cam, t_world2cam, r_base2gripper, t_base2gripper, opts)

View Source

Raising version of calibrateRobotWorldHandEye/5.

Link to this function

calibrationMatrixValues!(cameraMatrix, imageSize, apertureWidth, apertureHeight)

View Source

Raising version of calibrationMatrixValues/4.

Link to this function

camShift!(probImage, window, criteria)

View Source

Raising version of camShift/3.

Link to this function

canny!(image, threshold1, threshold2)

View Source

Raising version of canny/3.

Link to this function

canny!(dx, dy, threshold1, threshold2)

View Source

Raising version of canny/4.

Link to this function

canny!(dx, dy, threshold1, threshold2, opts)

View Source

Raising version of canny/5.

Raising version of cartToPolar/2.

Link to this function

cartToPolar!(x, y, opts)

View Source

Raising version of cartToPolar/3.

Link to this function

checkChessboard!(img, size)

View Source

Raising version of checkChessboard/2.

Link to this function

checkHardwareSupport!(feature)

View Source

Raising version of checkHardwareSupport/1.

Raising version of checkRange/1.

Raising version of checkRange/2.

Link to this function

circle!(img, center, radius, color)

View Source

Raising version of circle/4.

Link to this function

circle!(img, center, radius, color, opts)

View Source

Raising version of circle/5.

Link to this function

clipLine!(imgRect, pt1, pt2)

View Source

Raising version of clipLine/3.

Raising version of colorChange/2.

Link to this function

colorChange!(src, mask, opts)

View Source

Raising version of colorChange/3.

Link to this function

compare!(src1, src2, cmpop)

View Source

Raising version of compare/3.

Link to this function

compare!(src1, src2, cmpop, opts)

View Source

Raising version of compare/4.

Link to this function

compareHist!(h1, h2, method)

View Source

Raising version of compareHist/3.

Raising version of completeSymm/1.

Raising version of completeSymm/2.

Link to this function

composeRT!(rvec1, tvec1, rvec2, tvec2)

View Source

Raising version of composeRT/4.

Link to this function

composeRT!(rvec1, tvec1, rvec2, tvec2, opts)

View Source

Raising version of composeRT/5.

Link to this function

computeCorrespondEpilines!(points, whichImage, f)

View Source

Raising version of computeCorrespondEpilines/3.

Link to this function

computeCorrespondEpilines!(points, whichImage, f, opts)

View Source

Raising version of computeCorrespondEpilines/4.

Link to this function

computeECC!(templateImage, inputImage)

View Source

Raising version of computeECC/2.

Link to this function

computeECC!(templateImage, inputImage, opts)

View Source

Raising version of computeECC/3.

Link to this function

connectedComponents!(image)

View Source

Raising version of connectedComponents/1.

Link to this function

connectedComponents!(image, opts)

View Source

Raising version of connectedComponents/2.

Link to this function

connectedComponentsWithAlgorithm!(image, connectivity, ltype, ccltype)

View Source

Raising version of connectedComponentsWithAlgorithm/4.

Link to this function

connectedComponentsWithAlgorithm!(image, connectivity, ltype, ccltype, opts)

View Source

Raising version of connectedComponentsWithAlgorithm/5.

Link to this function

connectedComponentsWithStats!(image)

View Source

Raising version of connectedComponentsWithStats/1.

Link to this function

connectedComponentsWithStats!(image, opts)

View Source

Raising version of connectedComponentsWithStats/2.

Link to this function

connectedComponentsWithStatsWithAlgorithm!(image, connectivity, ltype, ccltype)

View Source

Raising version of connectedComponentsWithStatsWithAlgorithm/4.

Link to this function

connectedComponentsWithStatsWithAlgorithm!(image, connectivity, ltype, ccltype, opts)

View Source

Raising version of connectedComponentsWithStatsWithAlgorithm/5.

Raising version of contourArea/1.

Link to this function

contourArea!(contour, opts)

View Source

Raising version of contourArea/2.

Raising version of convertFp16/1.

Raising version of convertFp16/2.

Link to this function

convertMaps!(map1, map2, dstmap1type)

View Source

Raising version of convertMaps/3.

Link to this function

convertMaps!(map1, map2, dstmap1type, opts)

View Source

Raising version of convertMaps/4.

Link to this function

convertPointsFromHomogeneous!(src)

View Source

Raising version of convertPointsFromHomogeneous/1.

Link to this function

convertPointsFromHomogeneous!(src, opts)

View Source

Raising version of convertPointsFromHomogeneous/2.

Link to this function

convertPointsToHomogeneous!(src)

View Source

Raising version of convertPointsToHomogeneous/1.

Link to this function

convertPointsToHomogeneous!(src, opts)

View Source

Raising version of convertPointsToHomogeneous/2.

Raising version of convertScaleAbs/1.

Link to this function

convertScaleAbs!(src, opts)

View Source

Raising version of convertScaleAbs/2.

Raising version of convexHull/1.

Link to this function

convexHull!(points, opts)

View Source

Raising version of convexHull/2.

Link to this function

convexityDefects!(contour, convexhull)

View Source

Raising version of convexityDefects/2.

Link to this function

convexityDefects!(contour, convexhull, opts)

View Source

Raising version of convexityDefects/3.

Link to this function

copyMakeBorder!(src, top, bottom, left, right, borderType)

View Source

Raising version of copyMakeBorder/6.

Link to this function

copyMakeBorder!(src, top, bottom, left, right, borderType, opts)

View Source

Raising version of copyMakeBorder/7.

Raising version of copyTo/2.

Link to this function

copyTo!(src, mask, opts)

View Source

Raising version of copyTo/3.

Link to this function

cornerEigenValsAndVecs!(src, blockSize, ksize)

View Source

Raising version of cornerEigenValsAndVecs/3.

Link to this function

cornerEigenValsAndVecs!(src, blockSize, ksize, opts)

View Source

Raising version of cornerEigenValsAndVecs/4.

Link to this function

cornerHarris!(src, blockSize, ksize, k)

View Source

Raising version of cornerHarris/4.

Link to this function

cornerHarris!(src, blockSize, ksize, k, opts)

View Source

Raising version of cornerHarris/5.

Link to this function

cornerMinEigenVal!(src, blockSize)

View Source

Raising version of cornerMinEigenVal/2.

Link to this function

cornerMinEigenVal!(src, blockSize, opts)

View Source

Raising version of cornerMinEigenVal/3.

Link to this function

cornerSubPix!(image, corners, winSize, zeroZone, criteria)

View Source

Raising version of cornerSubPix/5.

Link to this function

correctMatches!(f, points1, points2)

View Source

Raising version of correctMatches/3.

Link to this function

correctMatches!(f, points1, points2, opts)

View Source

Raising version of correctMatches/4.

Raising version of countNonZero/1.

Raising version of createAlignMTB/0.

Raising version of createAlignMTB/1.

Link to this function

createBackgroundSubtractorKNN!()

View Source

Raising version of createBackgroundSubtractorKNN/0.

Link to this function

createBackgroundSubtractorKNN!(opts)

View Source

Raising version of createBackgroundSubtractorKNN/1.

Link to this function

createBackgroundSubtractorMOG2!()

View Source

Raising version of createBackgroundSubtractorMOG2/0.

Link to this function

createBackgroundSubtractorMOG2!(opts)

View Source

Raising version of createBackgroundSubtractorMOG2/1.

Link to this function

createCalibrateDebevec!()

View Source

Raising version of createCalibrateDebevec/0.

Link to this function

createCalibrateDebevec!(opts)

View Source

Raising version of createCalibrateDebevec/1.

Link to this function

createCalibrateRobertson!()

View Source

Raising version of createCalibrateRobertson/0.

Link to this function

createCalibrateRobertson!(opts)

View Source

Raising version of createCalibrateRobertson/1.

Raising version of createCLAHE/0.

Raising version of createCLAHE/1.

Link to this function

createGeneralizedHoughBallard!()

View Source

Raising version of createGeneralizedHoughBallard/0.

Link to this function

createGeneralizedHoughGuil!()

View Source

Raising version of createGeneralizedHoughGuil/0.

Link to this function

createHanningWindow!(winSize, type)

View Source

Raising version of createHanningWindow/2.

Link to this function

createHanningWindow!(winSize, type, opts)

View Source

Raising version of createHanningWindow/3.

Link to this function

createLineSegmentDetector!()

View Source

Raising version of createLineSegmentDetector/0.

Link to this function

createLineSegmentDetector!(opts)

View Source

Raising version of createLineSegmentDetector/1.

Raising version of createMergeDebevec/0.

Raising version of createMergeMertens/0.

Link to this function

createMergeMertens!(opts)

View Source

Raising version of createMergeMertens/1.

Raising version of createMergeRobertson/0.

Raising version of createTonemap/0.

Raising version of createTonemap/1.

Raising version of createTonemapDrago/0.

Link to this function

createTonemapDrago!(opts)

View Source

Raising version of createTonemapDrago/1.

Raising version of createTonemapMantiuk/0.

Link to this function

createTonemapMantiuk!(opts)

View Source

Raising version of createTonemapMantiuk/1.

Link to this function

createTonemapReinhard!()

View Source

Raising version of createTonemapReinhard/0.

Link to this function

createTonemapReinhard!(opts)

View Source

Raising version of createTonemapReinhard/1.

Raising version of cubeRoot/1.

Link to this function

cv_fisheye_CALIB_FIX_FOCAL_LENGTH()

View Source
Link to this function

cv_fisheye_CALIB_FIX_INTRINSIC()

View Source
Link to this function

cv_fisheye_CALIB_FIX_K1()

View Source
Link to this function

cv_fisheye_CALIB_FIX_K2()

View Source
Link to this function

cv_fisheye_CALIB_FIX_K3()

View Source
Link to this function

cv_fisheye_CALIB_FIX_K4()

View Source
Link to this function

cv_fisheye_CALIB_FIX_PRINCIPAL_POINT()

View Source
Link to this function

cv_fisheye_CALIB_USE_INTRINSIC_GUESS()

View Source
Link to this function

cv_fisheye_CALIB_ZERO_DISPARITY()

View Source
Link to this function

cv_SparseMat_MAGIC_VAL()

View Source

Raising version of cvtColor/2.

Link to this function

cvtColor!(src, code, opts)

View Source

Raising version of cvtColor/3.

Link to this function

cvtColorTwoPlane!(src1, src2, code)

View Source

Raising version of cvtColorTwoPlane/3.

Link to this function

cvtColorTwoPlane!(src1, src2, code, opts)

View Source

Raising version of cvtColorTwoPlane/4.

Raising version of dct/1.

Raising version of dct/2.

Raising version of decolor/1.

Raising version of decolor/2.

Link to this function

decomposeEssentialMat!(e)

View Source

Raising version of decomposeEssentialMat/1.

Link to this function

decomposeEssentialMat!(e, opts)

View Source

Raising version of decomposeEssentialMat/2.

Link to this function

decomposeHomographyMat!(h, k)

View Source

Raising version of decomposeHomographyMat/2.

Link to this function

decomposeHomographyMat!(h, k, opts)

View Source

Raising version of decomposeHomographyMat/3.

Link to this function

decomposeProjectionMatrix!(projMatrix)

View Source

Raising version of decomposeProjectionMatrix/1.

Link to this function

decomposeProjectionMatrix!(projMatrix, opts)

View Source

Raising version of decomposeProjectionMatrix/2.

Raising version of demosaicing/2.

Link to this function

demosaicing!(src, code, opts)

View Source

Raising version of demosaicing/3.

Raising version of detailEnhance/1.

Link to this function

detailEnhance!(src, opts)

View Source

Raising version of detailEnhance/2.

Raising version of determinant/1.

Raising version of dft/1.

Raising version of dft/2.

Raising version of dilate/2.

Link to this function

dilate!(src, kernel, opts)

View Source

Raising version of dilate/3.

Link to this function

displayOverlay!(winname, text)

View Source

Raising version of displayOverlay/2.

Link to this function

displayOverlay!(winname, text, opts)

View Source

Raising version of displayOverlay/3.

Link to this function

displayStatusBar!(winname, text)

View Source

Raising version of displayStatusBar/2.

Link to this function

displayStatusBar!(winname, text, opts)

View Source

Raising version of displayStatusBar/3.

Link to this function

distanceTransform!(src, distanceType, maskSize)

View Source

Raising version of distanceTransform/3.

Link to this function

distanceTransform!(src, distanceType, maskSize, opts)

View Source

Raising version of distanceTransform/4.

Link to this function

distanceTransformWithLabels!(src, distanceType, maskSize)

View Source

Raising version of distanceTransformWithLabels/3.

Link to this function

distanceTransformWithLabels!(src, distanceType, maskSize, opts)

View Source

Raising version of distanceTransformWithLabels/4.

Raising version of divide/2.

Link to this function

divide!(scale, src2, opts)

View Source

Raising version of divide/3.

Link to this function

divSpectrums!(a, b, flags)

View Source

Raising version of divSpectrums/3.

Link to this function

divSpectrums!(a, b, flags, opts)

View Source

Raising version of divSpectrums/4.

Link to this function

drawChessboardCorners!(image, patternSize, corners, patternWasFound)

View Source

Raising version of drawChessboardCorners/4.

Link to this function

drawContours!(image, contours, contourIdx, color)

View Source

Raising version of drawContours/4.

Link to this function

drawContours!(image, contours, contourIdx, color, opts)

View Source

Raising version of drawContours/5.

Link to this function

drawFrameAxes!(image, cameraMatrix, distCoeffs, rvec, tvec, length)

View Source

Raising version of drawFrameAxes/6.

Link to this function

drawFrameAxes!(image, cameraMatrix, distCoeffs, rvec, tvec, length, opts)

View Source

Raising version of drawFrameAxes/7.

Link to this function

drawKeypoints!(image, keypoints, outImage)

View Source

Raising version of drawKeypoints/3.

Link to this function

drawKeypoints!(image, keypoints, outImage, opts)

View Source

Raising version of drawKeypoints/4.

Link to this function

drawMarker!(img, position, color)

View Source

Raising version of drawMarker/3.

Link to this function

drawMarker!(img, position, color, opts)

View Source

Raising version of drawMarker/4.

Link to this function

drawMatches!(img1, keypoints1, img2, keypoints2, matches1to2, outImg)

View Source

Raising version of drawMatches/6.

Link to this function

drawMatches!(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchesThickness)

View Source

Raising version of drawMatches/7.

Link to this function

drawMatches!(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchesThickness, opts)

View Source

Raising version of drawMatches/8.

Link to this function

drawMatchesKnn!(img1, keypoints1, img2, keypoints2, matches1to2, outImg)

View Source

Raising version of drawMatchesKnn/6.

Link to this function

drawMatchesKnn!(img1, keypoints1, img2, keypoints2, matches1to2, outImg, opts)

View Source

Raising version of drawMatchesKnn/7.

Link to this function

edgePreservingFilter!(src)

View Source

Raising version of edgePreservingFilter/1.

Link to this function

edgePreservingFilter!(src, opts)

View Source

Raising version of edgePreservingFilter/2.

Raising version of eigen/1.

Raising version of eigen/2.

Raising version of eigenNonSymmetric/1.

Link to this function

eigenNonSymmetric!(src, opts)

View Source

Raising version of eigenNonSymmetric/2.

Link to this function

ellipse2Poly!(center, axes, angle, arcStart, arcEnd, delta)

View Source

Raising version of ellipse2Poly/6.

Link to this function

ellipse!(img, box, color)

View Source

Raising version of ellipse/3.

Link to this function

ellipse!(img, box, color, opts)

View Source

Raising version of ellipse/4.

Link to this function

ellipse!(img, center, axes, angle, startAngle, endAngle, color)

View Source

Raising version of ellipse/7.

Link to this function

ellipse!(img, center, axes, angle, startAngle, endAngle, color, opts)

View Source

Raising version of ellipse/8.

Link to this function

emd!(signature1, signature2, distType)

View Source

Raising version of emd/3.

Link to this function

emd!(signature1, signature2, distType, opts)

View Source

Raising version of emd/4.

Raising version of equalizeHist/1.

Link to this function

equalizeHist!(src, opts)

View Source

Raising version of equalizeHist/2.

Raising version of erode/2.

Link to this function

erode!(src, kernel, opts)

View Source

Raising version of erode/3.

Link to this function

estimateAffine2D!(from, to)

View Source

Raising version of estimateAffine2D/2.

Link to this function

estimateAffine2D!(pts1, pts2, params)

View Source

Raising version of estimateAffine2D/3.

Link to this function

estimateAffine2D!(pts1, pts2, params, opts)

View Source

Raising version of estimateAffine2D/4.

Link to this function

estimateAffine3D!(src, dst)

View Source

Raising version of estimateAffine3D/2.

Link to this function

estimateAffine3D!(src, dst, opts)

View Source

Raising version of estimateAffine3D/3.

Link to this function

estimateAffinePartial2D!(from, to)

View Source

Raising version of estimateAffinePartial2D/2.

Link to this function

estimateAffinePartial2D!(from, to, opts)

View Source

Raising version of estimateAffinePartial2D/3.

Link to this function

estimateChessboardSharpness!(image, patternSize, corners)

View Source

Raising version of estimateChessboardSharpness/3.

Link to this function

estimateChessboardSharpness!(image, patternSize, corners, opts)

View Source

Raising version of estimateChessboardSharpness/4.

Link to this function

estimateTranslation3D!(src, dst)

View Source

Raising version of estimateTranslation3D/2.

Link to this function

estimateTranslation3D!(src, dst, opts)

View Source

Raising version of estimateTranslation3D/3.

Raising version of exp/1.

Raising version of exp/2.

Link to this function

extractChannel!(src, coi)

View Source

Raising version of extractChannel/2.

Link to this function

extractChannel!(src, coi, opts)

View Source

Raising version of extractChannel/3.

Raising version of fastAtan2/2.

Link to this function

fastNlMeansDenoising!(src)

View Source

Raising version of fastNlMeansDenoising/1.

Link to this function

fastNlMeansDenoising!(src, h)

View Source

Raising version of fastNlMeansDenoising/2.

Link to this function

fastNlMeansDenoising!(src, h, opts)

View Source

Raising version of fastNlMeansDenoising/3.

Link to this function

fastNlMeansDenoisingColored!(src)

View Source

Raising version of fastNlMeansDenoisingColored/1.

Link to this function

fastNlMeansDenoisingColored!(src, opts)

View Source

Raising version of fastNlMeansDenoisingColored/2.

Link to this function

fastNlMeansDenoisingColoredMulti!(srcImgs, imgToDenoiseIndex, temporalWindowSize)

View Source

Raising version of fastNlMeansDenoisingColoredMulti/3.

Link to this function

fastNlMeansDenoisingColoredMulti!(srcImgs, imgToDenoiseIndex, temporalWindowSize, opts)

View Source

Raising version of fastNlMeansDenoisingColoredMulti/4.

Link to this function

fastNlMeansDenoisingMulti!(srcImgs, imgToDenoiseIndex, temporalWindowSize)

View Source

Raising version of fastNlMeansDenoisingMulti/3.

Link to this function

fastNlMeansDenoisingMulti!(srcImgs, imgToDenoiseIndex, temporalWindowSize, h)

View Source

Raising version of fastNlMeansDenoisingMulti/4.

Link to this function

fastNlMeansDenoisingMulti!(srcImgs, imgToDenoiseIndex, temporalWindowSize, h, opts)

View Source

Raising version of fastNlMeansDenoisingMulti/5.

Link to this function

fillConvexPoly!(img, points, color)

View Source

Raising version of fillConvexPoly/3.

Link to this function

fillConvexPoly!(img, points, color, opts)

View Source

Raising version of fillConvexPoly/4.

Link to this function

fillPoly!(img, pts, color)

View Source

Raising version of fillPoly/3.

Link to this function

fillPoly!(img, pts, color, opts)

View Source

Raising version of fillPoly/4.

Link to this function

filter2D!(src, ddepth, kernel)

View Source

Raising version of filter2D/3.

Link to this function

filter2D!(src, ddepth, kernel, opts)

View Source

Raising version of filter2D/4.

Link to this function

filterHomographyDecompByVisibleRefpoints!(rotations, normals, beforePoints, afterPoints)

View Source

Raising version of filterHomographyDecompByVisibleRefpoints/4.

Link to this function

filterHomographyDecompByVisibleRefpoints!(rotations, normals, beforePoints, afterPoints, opts)

View Source

Raising version of filterHomographyDecompByVisibleRefpoints/5.

Link to this function

filterSpeckles!(img, newVal, maxSpeckleSize, maxDiff)

View Source

Raising version of filterSpeckles/4.

Link to this function

filterSpeckles!(img, newVal, maxSpeckleSize, maxDiff, opts)

View Source

Raising version of filterSpeckles/5.

Link to this function

find4QuadCornerSubpix!(img, corners, region_size)

View Source

Raising version of find4QuadCornerSubpix/3.

Link to this function

findChessboardCorners!(image, patternSize)

View Source

Raising version of findChessboardCorners/2.

Link to this function

findChessboardCorners!(image, patternSize, opts)

View Source

Raising version of findChessboardCorners/3.

Link to this function

findChessboardCornersSB!(image, patternSize)

View Source

Raising version of findChessboardCornersSB/2.

Link to this function

findChessboardCornersSB!(image, patternSize, opts)

View Source

Raising version of findChessboardCornersSB/3.

Link to this function

findChessboardCornersSBWithMeta!(image, patternSize, flags)

View Source

Raising version of findChessboardCornersSBWithMeta/3.

Link to this function

findChessboardCornersSBWithMeta!(image, patternSize, flags, opts)

View Source

Raising version of findChessboardCornersSBWithMeta/4.

Link to this function

findCirclesGrid!(image, patternSize)

View Source

Raising version of findCirclesGrid/2.

Link to this function

findCirclesGrid!(image, patternSize, opts)

View Source

Raising version of findCirclesGrid/3.

Link to this function

findCirclesGrid!(image, patternSize, flags, blobDetector, parameters)

View Source

Raising version of findCirclesGrid/5.

Link to this function

findCirclesGrid!(image, patternSize, flags, blobDetector, parameters, opts)

View Source

Raising version of findCirclesGrid/6.

Link to this function

findContours!(image, mode, method)

View Source

Raising version of findContours/3.

Link to this function

findContours!(image, mode, method, opts)

View Source

Raising version of findContours/4.

Link to this function

findEssentialMat!(points1, points2)

View Source

Raising version of findEssentialMat/2.

Link to this function

findEssentialMat!(points1, points2, cameraMatrix)

View Source

Raising version of findEssentialMat/3.

Link to this function

findEssentialMat!(points1, points2, cameraMatrix, opts)

View Source

Raising version of findEssentialMat/4.

Link to this function

findEssentialMat!(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2)

View Source

Raising version of findEssentialMat/6.

Link to this function

findEssentialMat!(points1, points2, cameraMatrix1, cameraMatrix2, dist_coeff1, dist_coeff2, params)

View Source

Raising version of findEssentialMat/7.

Link to this function

findEssentialMat!(points1, points2, cameraMatrix1, cameraMatrix2, dist_coeff1, dist_coeff2, params, opts)

View Source

Raising version of findEssentialMat/8.

Link to this function

findFundamentalMat!(points1, points2)

View Source

Raising version of findFundamentalMat/2.

Link to this function

findFundamentalMat!(points1, points2, params)

View Source

Raising version of findFundamentalMat/3.

Link to this function

findFundamentalMat!(points1, points2, params, opts)

View Source

Raising version of findFundamentalMat/4.

Link to this function

findFundamentalMat!(points1, points2, method, ransacReprojThreshold, confidence, maxIters)

View Source

Raising version of findFundamentalMat/6.

Link to this function

findFundamentalMat!(points1, points2, method, ransacReprojThreshold, confidence, maxIters, opts)

View Source

Raising version of findFundamentalMat/7.

Link to this function

findHomography!(srcPoints, dstPoints)

View Source

Raising version of findHomography/2.

Link to this function

findHomography!(srcPoints, dstPoints, params)

View Source

Raising version of findHomography/3.

Link to this function

findHomography!(srcPoints, dstPoints, params, opts)

View Source

Raising version of findHomography/4.

Raising version of findNonZero/1.

Raising version of findNonZero/2.

Link to this function

findTransformECC!(templateImage, inputImage, warpMatrix)

View Source

Raising version of findTransformECC/3.

Link to this function

findTransformECC!(templateImage, inputImage, warpMatrix, opts)

View Source

Raising version of findTransformECC/4.

Link to this function

findTransformECC!(templateImage, inputImage, warpMatrix, motionType, criteria, inputMask, gaussFiltSize)

View Source

Raising version of findTransformECC/7.

Raising version of fitEllipse/1.

Raising version of fitEllipseAMS/1.

Link to this function

fitEllipseDirect!(points)

View Source

Raising version of fitEllipseDirect/1.

Link to this function

fitLine!(points, distType, param, reps, aeps)

View Source

Raising version of fitLine/5.

Link to this function

fitLine!(points, distType, param, reps, aeps, opts)

View Source

Raising version of fitLine/6.

Raising version of flip/2.

Link to this function

flip!(src, flipCode, opts)

View Source

Raising version of flip/3.

Link to this function

floodFill!(image, mask, seedPoint, newVal)

View Source

Raising version of floodFill/4.

Link to this function

floodFill!(image, mask, seedPoint, newVal, opts)

View Source

Raising version of floodFill/5.

Link to this function

gaussianBlur!(src, ksize, sigmaX)

View Source

Raising version of gaussianBlur/3.

Link to this function

gaussianBlur!(src, ksize, sigmaX, opts)

View Source

Raising version of gaussianBlur/4.

Link to this function

gemm!(src1, src2, alpha, src3, beta)

View Source

Raising version of gemm/5.

Link to this function

gemm!(src1, src2, alpha, src3, beta, opts)

View Source

Raising version of gemm/6.

Link to this function

getAffineTransform!(src, dst)

View Source

Raising version of getAffineTransform/2.

Raising version of getBuildInformation/0.

Raising version of getCPUFeaturesLine/0.

Raising version of getCPUTickCount/0.

Link to this function

getDefaultNewCameraMatrix!(cameraMatrix)

View Source

Raising version of getDefaultNewCameraMatrix/1.

Link to this function

getDefaultNewCameraMatrix!(cameraMatrix, opts)

View Source

Raising version of getDefaultNewCameraMatrix/2.

Link to this function

getDerivKernels!(dx, dy, ksize)

View Source

Raising version of getDerivKernels/3.

Link to this function

getDerivKernels!(dx, dy, ksize, opts)

View Source

Raising version of getDerivKernels/4.

Link to this function

getFontScaleFromHeight!(fontFace, pixelHeight)

View Source

Raising version of getFontScaleFromHeight/2.

Link to this function

getFontScaleFromHeight!(fontFace, pixelHeight, opts)

View Source

Raising version of getFontScaleFromHeight/3.

Link to this function

getGaborKernel!(ksize, sigma, theta, lambd, gamma)

View Source

Raising version of getGaborKernel/5.

Link to this function

getGaborKernel!(ksize, sigma, theta, lambd, gamma, opts)

View Source

Raising version of getGaborKernel/6.

Link to this function

getGaussianKernel!(ksize, sigma)

View Source

Raising version of getGaussianKernel/2.

Link to this function

getGaussianKernel!(ksize, sigma, opts)

View Source

Raising version of getGaussianKernel/3.

Link to this function

getHardwareFeatureName!(feature)

View Source

Raising version of getHardwareFeatureName/1.

Raising version of getLogLevel/0.

Raising version of getNumberOfCPUs/0.

Raising version of getNumThreads/0.

Link to this function

getOptimalDFTSize!(vecsize)

View Source

Raising version of getOptimalDFTSize/1.

Link to this function

getOptimalNewCameraMatrix!(cameraMatrix, distCoeffs, imageSize, alpha)

View Source

Raising version of getOptimalNewCameraMatrix/4.

Link to this function

getOptimalNewCameraMatrix!(cameraMatrix, distCoeffs, imageSize, alpha, opts)

View Source

Raising version of getOptimalNewCameraMatrix/5.

Link to this function

getPerspectiveTransform!(src, dst)

View Source

Raising version of getPerspectiveTransform/2.

Link to this function

getPerspectiveTransform!(src, dst, opts)

View Source

Raising version of getPerspectiveTransform/3.

Link to this function

getRectSubPix!(image, patchSize, center)

View Source

Raising version of getRectSubPix/3.

Link to this function

getRectSubPix!(image, patchSize, center, opts)

View Source

Raising version of getRectSubPix/4.

Link to this function

getRotationMatrix2D!(center, angle, scale)

View Source

Raising version of getRotationMatrix2D/3.

Link to this function

getStructuringElement!(shape, ksize)

View Source

Raising version of getStructuringElement/2.

Link to this function

getStructuringElement!(shape, ksize, opts)

View Source

Raising version of getStructuringElement/3.

Link to this function

getTextSize!(text, fontFace, fontScale, thickness)

View Source

Raising version of getTextSize/4.

Raising version of getThreadNum/0.

Raising version of getTickCount/0.

Raising version of getTickFrequency/0.

Link to this function

getTrackbarPos!(trackbarname, winname)

View Source

Raising version of getTrackbarPos/2.

Link to this function

getValidDisparityROI!(roi1, roi2, minDisparity, numberOfDisparities, blockSize)

View Source

Raising version of getValidDisparityROI/5.

Raising version of getVersionMajor/0.

Raising version of getVersionMinor/0.

Raising version of getVersionRevision/0.

Raising version of getVersionString/0.

Link to this function

getWindowImageRect!(winname)

View Source

Raising version of getWindowImageRect/1.

Link to this function

getWindowProperty!(winname, prop_id)

View Source

Raising version of getWindowProperty/2.

Link to this function

goodFeaturesToTrack!(image, maxCorners, qualityLevel, minDistance)

View Source

Raising version of goodFeaturesToTrack/4.

Link to this function

goodFeaturesToTrack!(image, maxCorners, qualityLevel, minDistance, opts)

View Source

Raising version of goodFeaturesToTrack/5.

Link to this function

goodFeaturesToTrack!(image, maxCorners, qualityLevel, minDistance, mask, blockSize, gradientSize)

View Source

Raising version of goodFeaturesToTrack/7.

Link to this function

goodFeaturesToTrack!(image, maxCorners, qualityLevel, minDistance, mask, blockSize, gradientSize, opts)

View Source

Raising version of goodFeaturesToTrack/8.

Link to this function

goodFeaturesToTrackWithQuality!(image, maxCorners, qualityLevel, minDistance, mask)

View Source

Raising version of goodFeaturesToTrackWithQuality/5.

Link to this function

goodFeaturesToTrackWithQuality!(image, maxCorners, qualityLevel, minDistance, mask, opts)

View Source

Raising version of goodFeaturesToTrackWithQuality/6.

Link to this function

grabCut!(img, mask, rect, bgdModel, fgdModel, iterCount)

View Source

Raising version of grabCut/6.

Link to this function

grabCut!(img, mask, rect, bgdModel, fgdModel, iterCount, opts)

View Source

Raising version of grabCut/7.

Link to this function

groupRectangles!(rectList, groupThreshold)

View Source

Raising version of groupRectangles/2.

Link to this function

groupRectangles!(rectList, groupThreshold, opts)

View Source

Raising version of groupRectangles/3.

Link to this function

haveImageReader!(filename)

View Source

Raising version of haveImageReader/1.

Link to this function

haveImageWriter!(filename)

View Source

Raising version of haveImageWriter/1.

Raising version of haveOpenVX/0.

Raising version of hconcat/1.

Raising version of hconcat/2.

Link to this function

houghCircles!(image, method, dp, minDist)

View Source

Raising version of houghCircles/4.

Link to this function

houghCircles!(image, method, dp, minDist, opts)

View Source

Raising version of houghCircles/5.

Link to this function

houghLines!(image, rho, theta, threshold)

View Source

Raising version of houghLines/4.

Link to this function

houghLines!(image, rho, theta, threshold, opts)

View Source

Raising version of houghLines/5.

Link to this function

houghLinesP!(image, rho, theta, threshold)

View Source

Raising version of houghLinesP/4.

Link to this function

houghLinesP!(image, rho, theta, threshold, opts)

View Source

Raising version of houghLinesP/5.

Link to this function

houghLinesPointSet!(point, lines_max, threshold, min_rho, max_rho, rho_step, min_theta, max_theta, theta_step)

View Source

Raising version of houghLinesPointSet/9.

Link to this function

houghLinesPointSet!(point, lines_max, threshold, min_rho, max_rho, rho_step, min_theta, max_theta, theta_step, opts)

View Source

Raising version of houghLinesPointSet/10.

Link to this function

houghLinesWithAccumulator!(image, rho, theta, threshold)

View Source

Raising version of houghLinesWithAccumulator/4.

Link to this function

houghLinesWithAccumulator!(image, rho, theta, threshold, opts)

View Source

Raising version of houghLinesWithAccumulator/5.

Raising version of huMoments/1.

Raising version of huMoments/2.

Raising version of idct/1.

Raising version of idct/2.

Raising version of idft/1.

Raising version of idft/2.

Link to this function

illuminationChange!(src, mask)

View Source

Raising version of illuminationChange/2.

Link to this function

illuminationChange!(src, mask, opts)

View Source

Raising version of illuminationChange/3.

Raising version of imcount/1.

Link to this function

imcount!(filename, opts)

View Source

Raising version of imcount/2.

Raising version of imdecode/2.

Raising version of imencode/2.

Link to this function

imencode!(ext, img, opts)

View Source

Raising version of imencode/3.

Raising version of imread/1.

Raising version of imread/2.

Raising version of imreadmulti/1.

Link to this function

imreadmulti!(filename, opts)

View Source

Raising version of imreadmulti/2.

Link to this function

imreadmulti!(filename, start, count)

View Source

Raising version of imreadmulti/3.

Link to this function

imreadmulti!(filename, start, count, opts)

View Source

Raising version of imreadmulti/4.

Raising version of imwrite/2.

Link to this function

imwrite!(filename, img, opts)

View Source

Raising version of imwrite/3.

Link to this function

imwritemulti!(filename, img)

View Source

Raising version of imwritemulti/2.

Link to this function

imwritemulti!(filename, img, opts)

View Source

Raising version of imwritemulti/3.

Link to this function

initCameraMatrix2D!(objectPoints, imagePoints, imageSize)

View Source

Raising version of initCameraMatrix2D/3.

Link to this function

initCameraMatrix2D!(objectPoints, imagePoints, imageSize, opts)

View Source

Raising version of initCameraMatrix2D/4.

Link to this function

initInverseRectificationMap!(cameraMatrix, distCoeffs, r, newCameraMatrix, size, m1type)

View Source

Raising version of initInverseRectificationMap/6.

Link to this function

initInverseRectificationMap!(cameraMatrix, distCoeffs, r, newCameraMatrix, size, m1type, opts)

View Source

Raising version of initInverseRectificationMap/7.

Link to this function

initUndistortRectifyMap!(cameraMatrix, distCoeffs, r, newCameraMatrix, size, m1type)

View Source

Raising version of initUndistortRectifyMap/6.

Link to this function

initUndistortRectifyMap!(cameraMatrix, distCoeffs, r, newCameraMatrix, size, m1type, opts)

View Source

Raising version of initUndistortRectifyMap/7.

Link to this function

inpaint!(src, inpaintMask, inpaintRadius, flags)

View Source

Raising version of inpaint/4.

Link to this function

inpaint!(src, inpaintMask, inpaintRadius, flags, opts)

View Source

Raising version of inpaint/5.

Link to this function

inRange!(src, lowerb, upperb)

View Source

Raising version of inRange/3.

Link to this function

inRange!(src, lowerb, upperb, opts)

View Source

Raising version of inRange/4.

Link to this function

insertChannel!(src, dst, coi)

View Source

Raising version of insertChannel/3.

Raising version of integral2/1.

Raising version of integral2/2.

Raising version of integral3/1.

Raising version of integral3/2.

Raising version of integral/1.

Raising version of integral/2.

Link to this function

intersectConvexConvex!(p1, p2)

View Source

Raising version of intersectConvexConvex/2.

Link to this function

intersectConvexConvex!(p1, p2, opts)

View Source

Raising version of intersectConvexConvex/3.

Raising version of invert/1.

Raising version of invert/2.

Link to this function

invertAffineTransform!(m)

View Source

Raising version of invertAffineTransform/1.

Link to this function

invertAffineTransform!(m, opts)

View Source

Raising version of invertAffineTransform/2.

Link to this function

isContourConvex!(contour)

View Source

Raising version of isContourConvex/1.

Link to this function

kmeans!(data, k, bestLabels, criteria, attempts, flags)

View Source

Raising version of kmeans/6.

Link to this function

kmeans!(data, k, bestLabels, criteria, attempts, flags, opts)

View Source

Raising version of kmeans/7.

Raising version of laplacian/2.

Link to this function

laplacian!(src, ddepth, opts)

View Source

Raising version of laplacian/3.

Link to this function

line!(img, pt1, pt2, color)

View Source

Raising version of line/4.

Link to this function

line!(img, pt1, pt2, color, opts)

View Source

Raising version of line/5.

Link to this function

linearPolar!(src, center, maxRadius, flags)

View Source

Raising version of linearPolar/4.

Link to this function

linearPolar!(src, center, maxRadius, flags, opts)

View Source

Raising version of linearPolar/5.

Raising version of log/1.

Raising version of log/2.

Link to this function

logPolar!(src, center, m, flags)

View Source

Raising version of logPolar/4.

Link to this function

logPolar!(src, center, m, flags, opts)

View Source

Raising version of logPolar/5.

Raising version of lut/2.

Raising version of lut/3.

Raising version of magnitude/2.

Raising version of magnitude/3.

Link to this function

mahalanobis!(v1, v2, icovar)

View Source

Raising version of mahalanobis/3.

Link to this function

matchShapes!(contour1, contour2, method, parameter)

View Source

Raising version of matchShapes/4.

Link to this function

matchTemplate!(image, templ, method)

View Source

Raising version of matchTemplate/3.

Link to this function

matchTemplate!(image, templ, method, opts)

View Source

Raising version of matchTemplate/4.

Raising version of matMulDeriv/2.

Link to this function

matMulDeriv!(a, b, opts)

View Source

Raising version of matMulDeriv/3.

Raising version of max/2.

Raising version of max/3.

Raising version of mean/1.

Raising version of mean/2.

Link to this function

meanShift!(probImage, window, criteria)

View Source

Raising version of meanShift/3.

Raising version of meanStdDev/1.

Raising version of meanStdDev/2.

Raising version of medianBlur/2.

Link to this function

medianBlur!(src, ksize, opts)

View Source

Raising version of medianBlur/3.

Raising version of merge/1.

Raising version of merge/2.

Raising version of min/2.

Raising version of min/3.

Raising version of minAreaRect/1.

Link to this function

minEnclosingCircle!(points)

View Source

Raising version of minEnclosingCircle/1.

Link to this function

minEnclosingTriangle!(points)

View Source

Raising version of minEnclosingTriangle/1.

Link to this function

minEnclosingTriangle!(points, opts)

View Source

Raising version of minEnclosingTriangle/2.

Raising version of minMaxLoc/1.

Raising version of minMaxLoc/2.

Link to this function

mixChannels!(src, dst, fromTo)

View Source

Raising version of mixChannels/3.

Raising version of moments/1.

Raising version of moments/2.

Link to this function

morphologyEx!(src, op, kernel)

View Source

Raising version of morphologyEx/3.

Link to this function

morphologyEx!(src, op, kernel, opts)

View Source

Raising version of morphologyEx/4.

Link to this function

moveWindow!(winname, x, y)

View Source

Raising version of moveWindow/3.

Link to this function

mulSpectrums!(a, b, flags)

View Source

Raising version of mulSpectrums/3.

Link to this function

mulSpectrums!(a, b, flags, opts)

View Source

Raising version of mulSpectrums/4.

Link to this function

mulTransposed!(src, aTa)

View Source

Raising version of mulTransposed/2.

Link to this function

mulTransposed!(src, aTa, opts)

View Source

Raising version of mulTransposed/3.

Raising version of multiply/2.

Link to this function

multiply!(src1, src2, opts)

View Source

Raising version of multiply/3.

Raising version of namedWindow/1.

Link to this function

namedWindow!(winname, opts)

View Source

Raising version of namedWindow/2.

Raising version of norm/1.

Raising version of norm/2.

Raising version of norm/3.

Raising version of normalize/2.

Link to this function

normalize!(src, dst, opts)

View Source

Raising version of normalize/3.

Raising version of patchNaNs/1.

Raising version of patchNaNs/2.

Link to this function

pcaBackProject!(data, mean, eigenvectors)

View Source

Raising version of pcaBackProject/3.

Link to this function

pcaBackProject!(data, mean, eigenvectors, opts)

View Source

Raising version of pcaBackProject/4.

Link to this function

pcaCompute2!(data, mean)

View Source

Raising version of pcaCompute2/2.

Link to this function

pcaCompute2!(data, mean, retainedVariance)

View Source

Raising version of pcaCompute2/3.

Link to this function

pcaCompute2!(data, mean, retainedVariance, opts)

View Source

Raising version of pcaCompute2/4.

Raising version of pcaCompute/2.

Link to this function

pcaCompute!(data, mean, retainedVariance)

View Source

Raising version of pcaCompute/3.

Link to this function

pcaCompute!(data, mean, retainedVariance, opts)

View Source

Raising version of pcaCompute/4.

Link to this function

pcaProject!(data, mean, eigenvectors)

View Source

Raising version of pcaProject/3.

Link to this function

pcaProject!(data, mean, eigenvectors, opts)

View Source

Raising version of pcaProject/4.

Raising version of pencilSketch/1.

Link to this function

pencilSketch!(src, opts)

View Source

Raising version of pencilSketch/2.

Link to this function

perspectiveTransform!(src, m)

View Source

Raising version of perspectiveTransform/2.

Link to this function

perspectiveTransform!(src, m, opts)

View Source

Raising version of perspectiveTransform/3.

Raising version of phase/2.

Raising version of phase/3.

Link to this function

phaseCorrelate!(src1, src2)

View Source

Raising version of phaseCorrelate/2.

Link to this function

phaseCorrelate!(src1, src2, opts)

View Source

Raising version of phaseCorrelate/3.

Link to this function

pointPolygonTest!(contour, pt, measureDist)

View Source

Raising version of pointPolygonTest/3.

Link to this function

polarToCart!(magnitude, angle)

View Source

Raising version of polarToCart/2.

Link to this function

polarToCart!(magnitude, angle, opts)

View Source

Raising version of polarToCart/3.

Raising version of pollKey/0.

Link to this function

polylines!(img, pts, isClosed, color)

View Source

Raising version of polylines/4.

Link to this function

polylines!(img, pts, isClosed, color, opts)

View Source

Raising version of polylines/5.

Raising version of pow/2.

Raising version of pow/3.

Link to this function

preCornerDetect!(src, ksize)

View Source

Raising version of preCornerDetect/2.

Link to this function

preCornerDetect!(src, ksize, opts)

View Source

Raising version of preCornerDetect/3.

Link to this function

projectPoints!(objectPoints, rvec, tvec, cameraMatrix, distCoeffs)

View Source

Raising version of projectPoints/5.

Link to this function

projectPoints!(objectPoints, rvec, tvec, cameraMatrix, distCoeffs, opts)

View Source

Raising version of projectPoints/6.

Raising version of psnr/2.

Raising version of psnr/3.

Link to this function

putText!(img, text, org, fontFace, fontScale, color)

View Source

Raising version of putText/6.

Link to this function

putText!(img, text, org, fontFace, fontScale, color, opts)

View Source

Raising version of putText/7.

Raising version of pyrDown/1.

Raising version of pyrDown/2.

Link to this function

pyrMeanShiftFiltering!(src, sp, sr)

View Source

Raising version of pyrMeanShiftFiltering/3.

Link to this function

pyrMeanShiftFiltering!(src, sp, sr, opts)

View Source

Raising version of pyrMeanShiftFiltering/4.

Raising version of pyrUp/1.

Raising version of pyrUp/2.

Link to this function

randn!(dst, mean, stddev)

View Source

Raising version of randn/3.

Raising version of randShuffle/1.

Raising version of randShuffle/2.

Raising version of randu/3.

Raising version of readOpticalFlow/1.

Link to this function

recoverPose!(e, points1, points2)

View Source

Raising version of recoverPose/3.

Link to this function

recoverPose!(e, points1, points2, cameraMatrix)

View Source

Raising version of recoverPose/4.

Link to this function

recoverPose!(e, points1, points2, cameraMatrix, distanceThresh)

View Source

Raising version of recoverPose/5.

Link to this function

recoverPose!(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2)

View Source

Raising version of recoverPose/6.

Link to this function

recoverPose!(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, opts)

View Source

Raising version of recoverPose/7.

Link to this function

rectangle!(img, rec, color)

View Source

Raising version of rectangle/3.

Link to this function

rectangle!(img, pt1, pt2, color)

View Source

Raising version of rectangle/4.

Link to this function

rectangle!(img, pt1, pt2, color, opts)

View Source

Raising version of rectangle/5.

Link to this function

rectify3Collinear!(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, cameraMatrix3, distCoeffs3, imgpt1, imgpt3, imageSize, r12, t12, r13, t13, alpha, newImgSize, flags)

View Source

Raising version of rectify3Collinear/16.

Link to this function

rectify3Collinear!(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, cameraMatrix3, distCoeffs3, imgpt1, imgpt3, imageSize, r12, t12, r13, t13, alpha, newImgSize, flags, opts)

View Source

Raising version of rectify3Collinear/17.

Link to this function

reduce!(src, dim, rtype)

View Source

Raising version of reduce/3.

Link to this function

reduce!(src, dim, rtype, opts)

View Source

Raising version of reduce/4.

Link to this function

reduceArgMax!(src, axis)

View Source

Raising version of reduceArgMax/2.

Link to this function

reduceArgMax!(src, axis, opts)

View Source

Raising version of reduceArgMax/3.

Link to this function

reduceArgMin!(src, axis)

View Source

Raising version of reduceArgMin/2.

Link to this function

reduceArgMin!(src, axis, opts)

View Source

Raising version of reduceArgMin/3.

Link to this function

remap!(src, map1, map2, interpolation)

View Source

Raising version of remap/4.

Link to this function

remap!(src, map1, map2, interpolation, opts)

View Source

Raising version of remap/5.

Raising version of repeat/3.

Link to this function

repeat!(src, ny, nx, opts)

View Source

Raising version of repeat/4.

Link to this function

reprojectImageTo3D!(disparity, q)

View Source

Raising version of reprojectImageTo3D/2.

Link to this function

reprojectImageTo3D!(disparity, q, opts)

View Source

Raising version of reprojectImageTo3D/3.

Raising version of resize/2.

Link to this function

resize!(src, dsize, opts)

View Source

Raising version of resize/3.

Link to this function

resizeWindow!(winname, size)

View Source

Raising version of resizeWindow/2.

Link to this function

resizeWindow!(winname, width, height)

View Source

Raising version of resizeWindow/3.

Raising version of rodrigues/1.

Raising version of rodrigues/2.

Link to this function

rotate!(src, rotateCode)

View Source

Raising version of rotate/2.

Link to this function

rotate!(src, rotateCode, opts)

View Source

Raising version of rotate/3.

Link to this function

rotatedRectangleIntersection!(rect1, rect2)

View Source

Raising version of rotatedRectangleIntersection/2.

Link to this function

rotatedRectangleIntersection!(rect1, rect2, opts)

View Source

Raising version of rotatedRectangleIntersection/3.

Raising version of rqDecomp3x3/1.

Raising version of rqDecomp3x3/2.

Link to this function

sampsonDistance!(pt1, pt2, f)

View Source

Raising version of sampsonDistance/3.

Link to this function

scaleAdd!(src1, alpha, src2)

View Source

Raising version of scaleAdd/3.

Link to this function

scaleAdd!(src1, alpha, src2, opts)

View Source

Raising version of scaleAdd/4.

Link to this function

scharr!(src, ddepth, dx, dy)

View Source

Raising version of scharr/4.

Link to this function

scharr!(src, ddepth, dx, dy, opts)

View Source

Raising version of scharr/5.

Link to this function

seamlessClone!(src, dst, mask, p, flags)

View Source

Raising version of seamlessClone/5.

Link to this function

seamlessClone!(src, dst, mask, p, flags, opts)

View Source

Raising version of seamlessClone/6.

Raising version of selectROI/1.

Link to this function

selectROI!(windowName, img)

View Source

Raising version of selectROI/2.

Link to this function

selectROI!(windowName, img, opts)

View Source

Raising version of selectROI/3.

Link to this function

selectROIs!(windowName, img)

View Source

Raising version of selectROIs/2.

Link to this function

selectROIs!(windowName, img, opts)

View Source

Raising version of selectROIs/3.

Link to this function

sepFilter2D!(src, ddepth, kernelX, kernelY)

View Source

Raising version of sepFilter2D/4.

Link to this function

sepFilter2D!(src, ddepth, kernelX, kernelY, opts)

View Source

Raising version of sepFilter2D/5.

Raising version of setIdentity/1.

Raising version of setIdentity/2.

Raising version of setLogLevel/1.

Link to this function

setNumThreads!(nthreads)

View Source

Raising version of setNumThreads/1.

Raising version of setRNGSeed/1.

Link to this function

setTrackbarMax!(trackbarname, winname, maxval)

View Source

Raising version of setTrackbarMax/3.

Link to this function

setTrackbarMin!(trackbarname, winname, minval)

View Source

Raising version of setTrackbarMin/3.

Link to this function

setTrackbarPos!(trackbarname, winname, pos)

View Source

Raising version of setTrackbarPos/3.

Raising version of setUseOpenVX/1.

Raising version of setUseOptimized/1.

Link to this function

setWindowProperty!(winname, prop_id, prop_value)

View Source

Raising version of setWindowProperty/3.

Link to this function

setWindowTitle!(winname, title)

View Source

Raising version of setWindowTitle/2.

Link to this function

sobel!(src, ddepth, dx, dy)

View Source

Raising version of sobel/4.

Link to this function

sobel!(src, ddepth, dx, dy, opts)

View Source

Raising version of sobel/5.

Raising version of solve/2.

Link to this function

solve!(src1, src2, opts)

View Source

Raising version of solve/3.

Raising version of solveCubic/1.

Link to this function

solveCubic!(coeffs, opts)

View Source

Raising version of solveCubic/2.

Raising version of solveLP/2.

Link to this function

solveLP!(func, constr, opts)

View Source

Raising version of solveLP/3.

Link to this function

solveP3P!(objectPoints, imagePoints, cameraMatrix, distCoeffs, flags)

View Source

Raising version of solveP3P/5.

Link to this function

solveP3P!(objectPoints, imagePoints, cameraMatrix, distCoeffs, flags, opts)

View Source

Raising version of solveP3P/6.

Link to this function

solvePnP!(objectPoints, imagePoints, cameraMatrix, distCoeffs)

View Source

Raising version of solvePnP/4.

Link to this function

solvePnP!(objectPoints, imagePoints, cameraMatrix, distCoeffs, opts)

View Source

Raising version of solvePnP/5.

Link to this function

solvePnPGeneric!(objectPoints, imagePoints, cameraMatrix, distCoeffs)

View Source

Raising version of solvePnPGeneric/4.

Link to this function

solvePnPGeneric!(objectPoints, imagePoints, cameraMatrix, distCoeffs, opts)

View Source

Raising version of solvePnPGeneric/5.

Link to this function

solvePnPRansac!(objectPoints, imagePoints, cameraMatrix, distCoeffs)

View Source

Raising version of solvePnPRansac/4.

Link to this function

solvePnPRansac!(objectPoints, imagePoints, cameraMatrix, distCoeffs, opts)

View Source

Raising version of solvePnPRansac/5.

Link to this function

solvePnPRefineLM!(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec)

View Source

Raising version of solvePnPRefineLM/6.

Link to this function

solvePnPRefineLM!(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, opts)

View Source

Raising version of solvePnPRefineLM/7.

Link to this function

solvePnPRefineVVS!(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec)

View Source

Raising version of solvePnPRefineVVS/6.

Link to this function

solvePnPRefineVVS!(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, opts)

View Source

Raising version of solvePnPRefineVVS/7.

Raising version of solvePoly/1.

Link to this function

solvePoly!(coeffs, opts)

View Source

Raising version of solvePoly/2.

Raising version of sort/2.

Raising version of sort/3.

Raising version of sortIdx/2.

Link to this function

sortIdx!(src, flags, opts)

View Source

Raising version of sortIdx/3.

Raising version of spatialGradient/1.

Link to this function

spatialGradient!(src, opts)

View Source

Raising version of spatialGradient/2.

Raising version of split/1.

Raising version of split/2.

Link to this function

sqrBoxFilter!(src, ddepth, ksize)

View Source

Raising version of sqrBoxFilter/3.

Link to this function

sqrBoxFilter!(src, ddepth, ksize, opts)

View Source

Raising version of sqrBoxFilter/4.

Raising version of sqrt/1.

Raising version of sqrt/2.

Raising version of startWindowThread/0.

Link to this function

stereoCalibrate!(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize)

View Source

Raising version of stereoCalibrate/8.

Link to this function

stereoCalibrate!(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, opts)

View Source

Raising version of stereoCalibrate/9.

Link to this function

stereoCalibrateExtended!(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, r, t)

View Source

Raising version of stereoCalibrateExtended/10.

Link to this function

stereoCalibrateExtended!(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, r, t, opts)

View Source

Raising version of stereoCalibrateExtended/11.

Link to this function

stereoRectify!(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, r, t)

View Source

Raising version of stereoRectify/7.

Link to this function

stereoRectify!(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, r, t, opts)

View Source

Raising version of stereoRectify/8.

Link to this function

stereoRectifyUncalibrated!(points1, points2, f, imgSize)

View Source

Raising version of stereoRectifyUncalibrated/4.

Link to this function

stereoRectifyUncalibrated!(points1, points2, f, imgSize, opts)

View Source

Raising version of stereoRectifyUncalibrated/5.

Raising version of stylization/1.

Raising version of stylization/2.

Raising version of subtract/2.

Link to this function

subtract!(src1, src2, opts)

View Source

Raising version of subtract/3.

Raising version of sumElems/1.

Link to this function

svBackSubst!(w, u, vt, rhs)

View Source

Raising version of svBackSubst/4.

Link to this function

svBackSubst!(w, u, vt, rhs, opts)

View Source

Raising version of svBackSubst/5.

Raising version of svdDecomp/1.

Raising version of svdDecomp/2.

Link to this function

textureFlattening!(src, mask)

View Source

Raising version of textureFlattening/2.

Link to this function

textureFlattening!(src, mask, opts)

View Source

Raising version of textureFlattening/3.

Link to this function

threshold!(src, thresh, maxval, type)

View Source

Raising version of threshold/4.

Link to this function

threshold!(src, thresh, maxval, type, opts)

View Source

Raising version of threshold/5.

Raising version of trace/1.

Raising version of transform/2.

Link to this function

transform!(src, m, opts)

View Source

Raising version of transform/3.

Raising version of transpose/1.

Raising version of transpose/2.

Link to this function

transposeND!(src, order)

View Source

Raising version of transposeND/2.

Link to this function

transposeND!(src, order, opts)

View Source

Raising version of transposeND/3.

Link to this function

triangulatePoints!(projMatr1, projMatr2, projPoints1, projPoints2)

View Source

Raising version of triangulatePoints/4.

Link to this function

triangulatePoints!(projMatr1, projMatr2, projPoints1, projPoints2, opts)

View Source

Raising version of triangulatePoints/5.

Link to this function

undistort!(src, cameraMatrix, distCoeffs)

View Source

Raising version of undistort/3.

Link to this function

undistort!(src, cameraMatrix, distCoeffs, opts)

View Source

Raising version of undistort/4.

Link to this function

undistortImagePoints!(src, cameraMatrix, distCoeffs)

View Source

Raising version of undistortImagePoints/3.

Link to this function

undistortImagePoints!(src, cameraMatrix, distCoeffs, opts)

View Source

Raising version of undistortImagePoints/4.

Link to this function

undistortPoints!(src, cameraMatrix, distCoeffs)

View Source

Raising version of undistortPoints/3.

Link to this function

undistortPoints!(src, cameraMatrix, distCoeffs, opts)

View Source

Raising version of undistortPoints/4.

Link to this function

undistortPointsIter!(src, cameraMatrix, distCoeffs, r, p, criteria)

View Source

Raising version of undistortPointsIter/6.

Link to this function

undistortPointsIter!(src, cameraMatrix, distCoeffs, r, p, criteria, opts)

View Source

Raising version of undistortPointsIter/7.

Raising version of useOpenVX/0.

Raising version of useOptimized/0.

Link to this function

validateDisparity!(disparity, cost, minDisparity, numberOfDisparities)

View Source

Raising version of validateDisparity/4.

Link to this function

validateDisparity!(disparity, cost, minDisparity, numberOfDisparities, opts)

View Source

Raising version of validateDisparity/5.

Raising version of vconcat/1.

Raising version of vconcat/2.

Raising version of waitKeyEx/0.

Raising version of waitKeyEx/1.

Link to this function

warpAffine!(src, m, dsize)

View Source

Raising version of warpAffine/3.

Link to this function

warpAffine!(src, m, dsize, opts)

View Source

Raising version of warpAffine/4.

Link to this function

warpPerspective!(src, m, dsize)

View Source

Raising version of warpPerspective/3.

Link to this function

warpPerspective!(src, m, dsize, opts)

View Source

Raising version of warpPerspective/4.

Link to this function

warpPolar!(src, dsize, center, maxRadius, flags)

View Source

Raising version of warpPolar/5.

Link to this function

warpPolar!(src, dsize, center, maxRadius, flags, opts)

View Source

Raising version of warpPolar/6.

Link to this function

watershed!(image, markers)

View Source

Raising version of watershed/2.

Link to this function

writeOpticalFlow!(path, flow)

View Source

Raising version of writeOpticalFlow/2.